<?php

namespace App\Models;

use App\Models\Permission;
// use Illuminate\Database\Eloquent\Model;
use MongoDB\Laravel\Eloquent\Model;

class Role extends Model
{
    protected $collection = 'roles';
    protected $fillable = ['name', 'permission_ids'];

    // protected $casts = [
    //     'permission_ids' => 'array',
    // ];

    public function permissions()
    {
        return Permission::whereIn('_id', $this->permission_ids)->get();
    }
}
