<?php 

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\PermissionType;

class UserOrgPermission extends Model
{
    use HasFactory;

    protected $fillable = ['user_id', 'org_id', 'permission_id', 'access_levels', 'description','name'];

    protected $casts = [
        'access_levels' => 'array',
    ];

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function permission()
    {
        return $this->belongsTo(PermissionType::class);
    }

    public function organisation()
    {
        return $this->belongsTo(Organisation::class);
    }
}
