xxxxxxxxxx
try {
// Your code to access the resource goes here
// If the access is successful, continue with the rest of your code
} catch (\Illuminate\Auth\Access\AuthorizationException $exception) {
// Access to the resource is denied
// You can handle the denied access by redirecting the user, showing an error message, or any other appropriate action
return redirect()->back()->with('error', 'Access to this resource is denied');
}
xxxxxxxxxx
Create and put this .htaccess file in your laravel installation(root) folder.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>