38 lines
920 B
PHP
38 lines
920 B
PHP
<?php
|
|
|
|
namespace App\Models\Commons;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use App\Traits\BelongsToTenant;
|
|
use App\Traits\ModelTrait;
|
|
|
|
class DepartmentPermission extends Model
|
|
{
|
|
use SoftDeletes, BelongsToTenant, ModelTrait;
|
|
|
|
protected $table = 'department_permissions';
|
|
|
|
protected $fillable = [
|
|
'tenant_id','department_id','permission_id','menu_id','is_allowed',
|
|
];
|
|
|
|
protected $casts = [
|
|
'tenant_id' => 'integer',
|
|
'department_id' => 'integer',
|
|
'permission_id' => 'integer',
|
|
'menu_id' => 'integer',
|
|
'is_allowed' => 'integer',
|
|
];
|
|
|
|
public function department()
|
|
{
|
|
return $this->belongsTo(Department::class, 'department_id');
|
|
}
|
|
|
|
public function permission()
|
|
{
|
|
return $this->belongsTo(\Spatie\Permission\Models\Permission::class, 'permission_id');
|
|
}
|
|
}
|