1. Go to this page and download the library: Download jeroen-g/laravel-auth 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/ */
jeroen-g / laravel-auth example snippets
if(Auth::can('edit'))
{
// show a form to edit stuff.
}
if(Auth::is('Moderator'))
{
// Show a form to edit stuff, if the 'Moderator' role has the 'edit' permission.
}
Auth::isAdmin();
Route::filter('auth.admin', function()
{
if ( ! Auth::isAdmin()) return Redirect::to('login');
});
Auth::allRoles();
Auth::allPermissions();
Auth::allUsers();
//Example of both optional parameter
Auth::allUsers('json', true);