Files
sam-api/app/Models/Commons/DepartmentPermission.php
2025-08-21 09:50:15 +09:00

41 lines
968 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;
/**
* @mixin IdeHelperDepartmentPermission
*/
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');
}
}