akaunting 3.0 (the last dance)
This commit is contained in:
@ -2,16 +2,15 @@
|
||||
|
||||
namespace App\Models\Auth;
|
||||
|
||||
use Akaunting\Sortable\Traits\Sortable;
|
||||
use App\Traits\Tenants;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Laratrust\Models\LaratrustRole;
|
||||
use Laratrust\Traits\LaratrustRoleTrait;
|
||||
use Kyslik\ColumnSortable\Sortable;
|
||||
use Lorisleiva\LaravelSearchString\Concerns\SearchString;
|
||||
|
||||
class Role extends LaratrustRole
|
||||
{
|
||||
use HasFactory, LaratrustRoleTrait, SearchString, Sortable, Tenants;
|
||||
use LaratrustRoleTrait, SearchString, Sortable, Tenants;
|
||||
|
||||
protected $table = 'roles';
|
||||
|
||||
@ -22,6 +21,40 @@ class Role extends LaratrustRole
|
||||
*/
|
||||
protected $fillable = ['name', 'display_name', 'description', 'created_from', 'created_by'];
|
||||
|
||||
/**
|
||||
* Get the line actions.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getLineActionsAttribute()
|
||||
{
|
||||
$actions = [];
|
||||
|
||||
$actions[] = [
|
||||
'title' => trans('general.edit'),
|
||||
'icon' => 'edit',
|
||||
'url' => route('roles.roles.edit', $this->id),
|
||||
'permission' => 'update-roles-roles',
|
||||
];
|
||||
|
||||
$actions[] = [
|
||||
'title' => trans('general.duplicate'),
|
||||
'icon' => 'file_copy',
|
||||
'url' => route('roles.roles.duplicate', $this->id),
|
||||
'permission' => 'create-roles-roles',
|
||||
];
|
||||
|
||||
$actions[] = [
|
||||
'type' => 'delete',
|
||||
'icon' => 'delete',
|
||||
'route' => 'roles.roles.destroy',
|
||||
'permission' => 'delete-roles-roles',
|
||||
'model' => $this,
|
||||
];
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope to get all rows filtered, sorted and paginated.
|
||||
*
|
||||
@ -39,14 +72,4 @@ class Role extends LaratrustRole
|
||||
|
||||
return $query->usingSearchString($search)->sortable($sort)->paginate($limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \Database\Factories\Role::new();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user