You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
518 B
27 lines
518 B
|
1 week ago
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||
|
|
|
||
|
|
class Permission extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = [
|
||
|
|
'code',
|
||
|
|
'name',
|
||
|
|
'type',
|
||
|
|
'parent_id',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'type' => 'integer',
|
||
|
|
'parent_id' => 'integer',
|
||
|
|
];
|
||
|
|
|
||
|
|
public function roles(): BelongsToMany
|
||
|
|
{
|
||
|
|
return $this->belongsToMany(Role::class, 'role_permissions', 'permission_id', 'role_id');
|
||
|
|
}
|
||
|
|
}
|