Initial commit: Struktur aplikasi ilycats
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace App\Traits;
|
||||
|
||||
trait HasPermissions {
|
||||
public function hasPermission($moduleSlug, $action) {
|
||||
// Jika user tidak punya role, akses ditolak
|
||||
if (!$this->role) return false;
|
||||
|
||||
// Cek ke tabel permission_role
|
||||
return $this->role->permissions()
|
||||
->where('module_slug', $moduleSlug)
|
||||
->where($action, 1)
|
||||
->exists();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user