'datetime', ]; public function permissions() { return $this->hasMany(Permission::class); } public function departments() { return $this->belongsToMany(Department::class, 'permissions', 'user_id', 'division_id')->wherePivot('level', '=', 1); } public function faculties() { return $this->belongsToMany(Faculty::class, 'permissions', 'user_id', 'division_id')->wherePivot('level', '=', 2); } public function getIsAdminAttribute() { return $this->permissions->where('level', '=', 3)->isNotEmpty(); } }