mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Set purchase cost to null if user has no permission to view the price
This commit is contained in:
parent
43d66a8fcc
commit
ef66188041
|
@ -4,6 +4,7 @@ namespace App\Models;
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
class SnipeModel extends Model
|
class SnipeModel extends Model
|
||||||
{
|
{
|
||||||
|
@ -160,4 +161,13 @@ class SnipeModel extends Model
|
||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPurchaseCostAttribute($value)
|
||||||
|
{
|
||||||
|
if (Auth::check() && !Auth::user()->can('self.view_purchase_cost')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue