PHP code example of alexkramse / laravel-hide-forbidden

1. Go to this page and download the library: Download alexkramse/laravel-hide-forbidden library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alexkramse / laravel-hide-forbidden example snippets


Route::middleware('hide-forbidden')->group(function (): void {
    Route::get('/admin/secret', SecretController::class);
});

'enabled' => env('HIDE_FORBIDDEN_ENABLED', env('APP_ENV', 'production') === 'production'),
'mode' => env('HIDE_FORBIDDEN_MODE', 'middleware'),

// config/hide-forbidden.php
'mode' => 'all',

'mode' => 'routes',

'only_routes' => [
    'admin.*',
    'teams.members.*',
],

'mode' => 'paths',

'only_paths' => [
    'admin/*',
    'internal/*',
],

'except_routes' => [
    'login',
    'logout',
    'register',
    'password.*',
    'verification.*',
    'sanctum.csrf-cookie',
],

'api_response' => [
    'message' => 'Not Found',
],

'guards' => [
    'admin',
],

'log_original_403' => true,
bash
php artisan vendor:publish --tag=hide-forbidden-config