123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace App\Policies;
- use App\Models\User;
- use Illuminate\Auth\Access\HandlesAuthorization;
- class UserPolicy
- {
- use HandlesAuthorization;
- /**
- * Create a new policy instance.
- *
- * @return void
- */
- public function __construct()
- {
- //
- }
- public function admin(User $user)
- {
- return $user->role->code === "admin";
- }
- public function user(User $user)
- {
- return $user->role->code === "user";
- }
- }
|