mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-11 21:52:35 +01:00
90e1f6695c
* Hide links based on permissions * Restrict editing/creating within other UI
30 lines
605 B
PHP
30 lines
605 B
PHP
<?php namespace App\Models;
|
|
|
|
use Auth;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Product extends EntityModel
|
|
{
|
|
use SoftDeletes;
|
|
protected $dates = ['deleted_at'];
|
|
|
|
public function getEntityType()
|
|
{
|
|
return ENTITY_PRODUCT;
|
|
}
|
|
|
|
public static function findProductByKey($key)
|
|
{
|
|
return Product::scope()->where('product_key', '=', $key)->first();
|
|
}
|
|
|
|
public function default_tax_rate()
|
|
{
|
|
return $this->belongsTo('App\Models\TaxRate');
|
|
}
|
|
|
|
public function canEdit() {
|
|
return Auth::user()->hasPermission('admin');
|
|
}
|
|
}
|