PHP code example of jjanampa / laravel-admin

1. Go to this page and download the library: Download jjanampa/laravel-admin 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/ */

    

jjanampa / laravel-admin example snippets


    // Check role anywhere
    if (auth('admin')->user()->hasRole('editor')) {
        // Do admin stuff here
    } else {
        // Do nothing
    }

    // Check role in route middleware
   Route::resource('pages', 'Dashboard\PagesController')->middleware('role:editor');
    

    if (auth('admin')->user()->can('permission-name')) {
        // Do something
    }
    

    php artisan laravel-admin:install