SystemPermission.php 611 Bytes
<?php

namespace App\Models;

use App\Models\Pivots\RolePermissionPivot;
use App\Support\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\SoftDeletes;

class SystemPermission extends Model
{
    use SoftDeletes;

    protected $table = 'system_permissions';

    protected $hidden = ['deleted_at','pivot'];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function roles(): BelongsToMany
    {
        return $this->belongsToMany(SystemRole::class, RolePermissionPivot::class, 'permission_id', 'role_id');
    }
}