if user is admin
i want a functionallity where i want that if user is admin = 1 it can go to dashbaord but if is admin is 0 than he can not access the admin panel currently i am using this functionallity which is give in filamentphp documentation and i created a code in user model like this
but i also got this given image.
But i want that if i can not access the admin panel it will show error in the login page and i want a error message like "you are not admin" i dont want given image result how can i archive this functionallity with custom error message if is_admin=0 this will show in admin page like "this email address is not admin /or somthing other custom error message insted of 403 forbidden message"
public function canAccessPanel(Panel $panel): bool { $user = User::where('email', $this->email)->first(); if ($user && $user->is_admin === 1) { return true; } return false; }
but i also got this given image.
But i want that if i can not access the admin panel it will show error in the login page and i want a error message like "you are not admin" i dont want given image result how can i archive this functionallity with custom error message if is_admin=0 this will show in admin page like "this email address is not admin /or somthing other custom error message insted of 403 forbidden message"
