• Stars
    star
    891
  • Rank 51,013 (Top 2 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Powerful package for handling roles and permissions in Laravel with GUI. Supports Laravel 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6.0, 7.0, 8.0, and 9.0

Laravel Roles

Laravel Roles

A Powerful package for handling roles and permissions in Laravel. Supports Laravel 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6.0, 7.0, and 8.0+.

Total Downloads Latest Stable Version Travis-CI Build Status Scrutinizer-CI Build Status StyleCI Scrutinizer Code Quality Code Intelligence Status License: MIT MadeWithLaravel.com shield

Table of contents

Features

Laravel Roles Features
Built in migrations with ability to publish and modify your own.
Built in seed with ability to publish and modify your own.
Roles with levels and relationships to users, permissions
Permissions with relationships to users and levels
Soft deletes with full restore and destroy
Optional CRUD of Roles and Permissions
Lots of configuration options
All Extendable from .env

Installation

This package is very easy to set up. There are only couple of steps.

Composer

From your projects root folder in terminal run:

Laravel 5.8 and up use:

    composer require jeremykenedy/laravel-roles

Laravel 5.7 and below use:

    composer require jeremykenedy/laravel-roles:1.4.0
  • Note: The major difference is that Laravel's users table migration out the box changed from $table->increments('id'); to $table->bigIncrements('id'); in Laravel 5.8.

Service Provider

  • Laravel 5.5 and up Uses package auto discovery feature, no need to edit the config/app.php file.

  • Laravel 5.4 and below Add the package to your application service providers in config/app.php file.

'providers' => [

    ...

    /**
     * Third Party Service Providers...
     */
    jeremykenedy\LaravelRoles\RolesServiceProvider::class,

],

Publish All Assets

    php artisan vendor:publish --tag=laravelroles

Publish Specific Assets

    php artisan vendor:publish --tag=laravelroles-config
    php artisan vendor:publish --tag=laravelroles-migrations
    php artisan vendor:publish --tag=laravelroles-seeds
    php artisan vendor:publish --tag=laravelroles-views
    php artisan vendor:publish --tag=laravelroles-lang

HasRoleAndPermission Trait And Contract

  1. Include HasRoleAndPermission trait and also implement HasRoleAndPermission contract inside your User model. See example below.

  2. Include use jeremykenedy\LaravelRoles\Traits\HasRoleAndPermission; in the top of your User model below the namespace and implement the HasRoleAndPermission trait. See example below.

Example User model Trait And Contract:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
use jeremykenedy\LaravelRoles\Traits\HasRoleAndPermission;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;
    use HasRoleAndPermission;

    // rest of your model ...
}

Migrations and seeds

This uses the default users table which is in Laravel. You should already have the migration file for the users table available and migrated.

  1. Setup the needed tables:

    php artisan migrate

  2. Update database\seeds\DatabaseSeeder.php to include the seeds. See example below.

<?php

use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use Database\Seeders\PermissionsTableSeeder;
use Database\Seeders\RolesTableSeeder;
use Database\Seeders\ConnectRelationshipsSeeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Model::unguard();

            $this->call(PermissionsTableSeeder::class);
            $this->call(RolesTableSeeder::class);
            $this->call(ConnectRelationshipsSeeder::class);
            //$this->call('UsersTableSeeder');

        Model::reguard();
    }
}
  1. Seed an initial set of Permissions, Roles, and Users with roles.
composer dump-autoload
php artisan db:seed

Roles Seeded

Property Value
Name Admin
Slug admin
Description Admin Role
Level 5
Property Value
Name User
Slug user
Description User Role
Level 1
Property Value
Name Unverified
Slug unverified
Description Unverified Role
Level 0

Permissions Seeded:

Property Value
name Can View Users
slug view.users
description Can view users
model Permission
Property Value
name Can Create Users
slug create.users
description Can create new users
model Permission
Property Value
name Can Edit Users
slug edit.users
description Can edit users
model Permission
Property Value
name Can Delete Users
slug delete.users
description Can delete users
model Permission

And that's it!


Migrate from bican roles

If you migrate from bican/roles to jeremykenedy/LaravelRoles you will need to update a few things.

  • Change all calls to can, canOne and canAll to hasPermission, hasOnePermission, hasAllPermissions.
  • Change all calls to is, isOne and isAll to hasRole, hasOneRole, hasAllRoles.

Usage

Creating Roles

$adminRole = config('roles.models.role')::create([
    'name' => 'Admin',
    'slug' => 'admin',
    'description' => '',
    'level' => 5,
]);

$moderatorRole = config('roles.models.role')::create([
    'name' => 'Forum Moderator',
    'slug' => 'forum.moderator',
]);

Because of Slugable trait, if you make a mistake and for example leave a space in slug parameter, it'll be replaced with a dot automatically, because of str_slug function.

Attaching, Detaching and Syncing Roles

It's really simple. You fetch a user from database and call attachRole method. There is BelongsToMany relationship between User and Role model.

$user = config('roles.models.defaultUser')::find($id);

$user->attachRole($adminRole); // you can pass whole object, or just an id
$user->detachRole($adminRole); // in case you want to detach role
$user->detachAllRoles(); // in case you want to detach all roles
$user->syncRoles($roles); // you can pass Eloquent collection, or just an array of ids

Assign a user role to new registered users

You can assign the user a role upon the users registration by updating the file app\Http\Controllers\Auth\RegisterController.php. You can assign a role to a user upon registration by including the needed models and modifying the create() method to attach a user role. See example below:

  • Updated create() method of app\Http\Controllers\Auth\RegisterController.php:
    protected function create(array $data)
    {
        $user = config('roles.models.defaultUser')::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
        ]);

        $role = config('roles.models.role')::where('name', '=', 'User')->first();  //choose the default role upon user creation.
        $user->attachRole($role);

        return $user;

    }

Checking For Roles

You can now check if the user has required role.

if ($user->hasRole('admin')) { // you can pass an id or slug
    //
}

You can also do this:

if ($user->isAdmin()) {
    //
}

And of course, there is a way to check for multiple roles:

if ($user->hasRole(['admin', 'moderator'])) {
    /*
    | Or alternatively:
    | $user->hasRole('admin, moderator'), $user->hasRole('admin|moderator'),
    | $user->hasOneRole('admin, moderator'), $user->hasOneRole(['admin', 'moderator']), $user->hasOneRole('admin|moderator')
    */

    // The user has at least one of the roles
}

if ($user->hasRole(['admin', 'moderator'], true)) {
    /*
    | Or alternatively:
    | $user->hasRole('admin, moderator', true), $user->hasRole('admin|moderator', true),
    | $user->hasAllRoles('admin, moderator'), $user->hasAllRoles(['admin', 'moderator']), $user->hasAllRoles('admin|moderator')
    */

    // The user has all roles
}

Levels

When you are creating roles, there is optional parameter level. It is set to 1 by default, but you can overwrite it and then you can do something like this:

if ($user->level() > 4) {
    //
}

If user has multiple roles, method level returns the highest one.

Level has also big effect on inheriting permissions. About it later.

Creating Permissions

It's very simple thanks to Permission model called from config('roles.models.permission').

$createUsersPermission = config('roles.models.permission')::create([
    'name' => 'Create users',
    'slug' => 'create.users',
    'description' => '', // optional
]);

$deleteUsersPermission = config('roles.models.permission')::create([
    'name' => 'Delete users',
    'slug' => 'delete.users',
]);

Attaching, Detaching and Syncing Permissions

You can attach permissions to a role or directly to a specific user (and of course detach them as well).

$role = config('roles.models.role')::find($roleId);
$role->attachPermission($createUsersPermission); // permission attached to a role

$user = config('roles.models.defaultUser')::find($userId);
$user->attachPermission($deleteUsersPermission); // permission attached to a user
$role->detachPermission($createUsersPermission); // in case you want to detach permission
$role->detachAllPermissions(); // in case you want to detach all permissions
$role->syncPermissions($permissions); // you can pass Eloquent collection, or just an array of ids

$user->detachPermission($deleteUsersPermission);
$user->detachAllPermissions();
$user->syncPermissions($permissions); // you can pass Eloquent collection, or just an array of ids

Checking For Permissions

if ($user->hasPermission('create.users')) { // you can pass an id or slug
    //
}

if ($user->canDeleteUsers()) {
    //
}

You can check for multiple permissions the same way as roles. You can make use of additional methods like hasOnePermission or hasAllPermissions.

Permissions Inheritance

By default, roles with higher level inherit all permissions from roles with lower level.

For example:

You have three roles: user, moderator and admin. User has a permission to read articles, moderator can manage comments and admin can create articles. User has a level 1, moderator level 2 and admin level 3. With inheritance enabled, moderator and administrator also have the permission to read articles, and administrator can manage comments as well.

If you don't want the permissions inheritance feature enabled in you application, set the config value roles.inheritance (or its corresponding .env parameter, ROLES_INHERITANCE) to false. Alternatively, simply ignore the level parameter when you're creating roles.

Entity Check

Let's say you have an article and you want to edit it. This article belongs to a user (there is a column user_id in articles table).

use App\Article;

$editArticlesPermission = config('roles.models.permission')::create([
    'name' => 'Edit articles',
    'slug' => 'edit.articles',
    'model' => 'App\Article',
]);

$user->attachPermission($editArticlesPermission);

$article = Article::find(1);

if ($user->allowed('edit.articles', $article)) { // $user->allowedEditArticles($article)
    //
}

This condition checks if the current user is the owner of article. If not, it will be looking inside user permissions for a row we created before.

if ($user->allowed('edit.articles', $article, false)) { // now owner check is disabled
    //
}

Blade Extensions

There are four Blade extensions. Basically, it is replacement for classic if statements.

@role('admin') // @if(Auth::check() && Auth::user()->hasRole('admin'))
    // user has admin role
@endrole

@permission('edit.articles') // @if(Auth::check() && Auth::user()->hasPermission('edit.articles'))
    // user has edit articles permissison
@endpermission

@level(2) // @if(Auth::check() && Auth::user()->level() >= 2)
    // user has level 2 or higher
@endlevel

@allowed('edit', $article) // @if(Auth::check() && Auth::user()->allowed('edit', $article))
    // show edit button
@endallowed

@role('admin|moderator', true) // @if(Auth::check() && Auth::user()->hasRole('admin|moderator', true))
    // user has admin and moderator role
@else
    // something else
@endrole

Middleware

This package comes with VerifyRole, VerifyPermission and VerifyLevel middleware. The middleware aliases are already registered in \jeremykenedy\LaravelRoles\RolesServiceProvider as of 1.7. You can optionally add them inside your app/Http/Kernel.php file with your own aliases like outlined below:

/**
 * The application's route middleware.
 *
 * @var array
 */
protected $routeMiddleware = [
    'auth' => \App\Http\Middleware\Authenticate::class,
    'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
    'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
    'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
    'can' => \Illuminate\Auth\Middleware\Authorize::class,
    'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
    'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
    'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
    'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
    'role' => \jeremykenedy\LaravelRoles\App\Http\Middleware\VerifyRole::class,
    'permission' => \jeremykenedy\LaravelRoles\App\Http\Middleware\VerifyPermission::class,
    'level' => \jeremykenedy\LaravelRoles\App\Http\Middleware\VerifyLevel::class,
];

Now you can easily protect your routes.

Route::get('/', function () {
    //
})->middleware('role:admin');

Route::get('/', function () {
    //
})->middleware('permission:edit.articles');

Route::get('/', function () {
    //
})->middleware('level:2'); // level >= 2

Route::get('/', function () {
    //
})->middleware('role:admin', 'level:2'); // level >= 2 and Admin

Route::group(['middleware' => ['role:admin']], function () {
    //
});

It throws \jeremykenedy\LaravelRoles\App\Exceptions\RoleDeniedException, \jeremykenedy\LaravelRoles\App\Exceptions\PermissionDeniedException or \jeremykenedy\LaravelRoles\App\Exceptions\LevelDeniedException exceptions if it goes wrong.

You can catch these exceptions inside app/Exceptions/Handler.php file and do whatever you want.

    /**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Throwable  $e
     * @return \Illuminate\Http\Response
     */
    public function render($request, Throwable $e)
	{
		$userLevelCheck = $e instanceof \jeremykenedy\LaravelRoles\App\Exceptions\RoleDeniedException ||
			$e instanceof \jeremykenedy\LaravelRoles\App\Exceptions\PermissionDeniedException ||
			$e instanceof \jeremykenedy\LaravelRoles\App\Exceptions\LevelDeniedException;
		
		if ($userLevelCheck) {
			
			if ($request->expectsJson()) {
				return Response::json(array(
					'error'    =>  403,
					'message'   =>  'Unauthorized.'
				), 403);
			}
			
			abort(403);
		}
		
		return parent::render($request, $e);
	}

Configuration

  • You can change connection for models, slug separator, models path and there is also a handy pretend feature.
  • There are many configurable options which have been extended to be able to configured via .env file variables.
  • Editing the configuration file directly may not needed becuase of this.
  • See config file: roles.php.
<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Package Connection
    |--------------------------------------------------------------------------
    |
    | You can set a different database connection for this package. It will set
    | new connection for models Role and Permission. When this option is null,
    | it will connect to the main database, which is set up in database.php
    |
    */

    'connection'            => env('ROLES_DATABASE_CONNECTION', null),
    'rolesTable'            => env('ROLES_ROLES_DATABASE_TABLE', 'roles'),
    'roleUserTable'         => env('ROLES_ROLE_USER_DATABASE_TABLE', 'role_user'),
    'permissionsTable'      => env('ROLES_PERMISSIONS_DATABASE_TABLE', 'permissions'),
    'permissionsRoleTable'  => env('ROLES_PERMISSION_ROLE_DATABASE_TABLE', 'permission_role'),
    'permissionsUserTable'  => env('ROLES_PERMISSION_USER_DATABASE_TABLE', 'permission_user'),

    /*
    |--------------------------------------------------------------------------
    | Slug Separator
    |--------------------------------------------------------------------------
    |
    | Here you can change the slug separator. This is very important in matter
    | of magic method __call() and also a `Slugable` trait. The default value
    | is a dot.
    |
    */

    'separator' => env('ROLES_DEFAULT_SEPARATOR', '.'),

    /*
    |--------------------------------------------------------------------------
    | Models
    |--------------------------------------------------------------------------
    |
    | If you want, you can replace default models from this package by models
    | you created. Have a look at `jeremykenedy\LaravelRoles\Models\Role` model and
    | `jeremykenedy\LaravelRoles\Models\Permission` model.
    |
    */

    'models' => [
        'role'          => env('ROLES_DEFAULT_ROLE_MODEL', jeremykenedy\LaravelRoles\Models\Role::class),
        'permission'    => env('ROLES_DEFAULT_PERMISSION_MODEL', jeremykenedy\LaravelRoles\Models\Permission::class),
        'defaultUser'   => env('ROLES_DEFAULT_USER_MODEL', config('auth.providers.users.model')),
    ],

    /*
    |--------------------------------------------------------------------------
    | Roles, Permissions and Allowed "Pretend"
    |--------------------------------------------------------------------------
    |
    | You can pretend or simulate package behavior no matter what is in your
    | database. It is really useful when you are testing you application.
    | Set up what will methods hasRole(), hasPermission() and allowed() return.
    |
    */

    'pretend' => [
        'enabled' => false,
        'options' => [
            'hasRole'       => true,
            'hasPermission' => true,
            'allowed'       => true,
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Default Migrations
    |--------------------------------------------------------------------------
    |
    | These are the default package migrations. If you publish the migrations
    | to your project, then this is not necessary and should be disabled. This
    | will enable our default migrations.
    |
    */
    'defaultMigrations' => [
        'enabled'        => env('ROLES_MIGRATION_DEFAULT_ENABLED', false),
    ],

    /*
    |--------------------------------------------------------------------------
    | Default Seeds
    |--------------------------------------------------------------------------
    |
    | These are the default package seeds. You can seed the package built
    | in seeds without having to seed them. These seed directly from
    | the package. These are not the published seeds.
    |
    */

    'defaultSeeds' => [
        'PermissionsTableSeeder'        => env('ROLES_SEED_DEFAULT_PERMISSIONS', true),
        'RolesTableSeeder'              => env('ROLES_SEED_DEFAULT_ROLES', true),
        'ConnectRelationshipsSeeder'    => env('ROLES_SEED_DEFAULT_RELATIONSHIPS', true),
        'UsersTableSeeder'              => env('ROLES_SEED_DEFAULT_USERS', false),
    ],

    /*
    |--------------------------------------------------------------------------
    | Laravel Roles GUI Settings
    |--------------------------------------------------------------------------
    |
    | This is the GUI for Laravel Roles to be able to CRUD them
    | easily and fast. This is optional and is not needed
    | for your application.
    |
    */

    // Enable Optional Roles Gui
    'rolesGuiEnabled'               => env('ROLES_GUI_ENABLED', false),

    // Enable `auth` middleware
    'rolesGuiAuthEnabled'           => env('ROLES_GUI_AUTH_ENABLED', true),

    // Enable Roles GUI middleware
    'rolesGuiMiddlewareEnabled'     => env('ROLES_GUI_MIDDLEWARE_ENABLED', true),

    // Optional Roles GUI Middleware
    'rolesGuiMiddleware'            => env('ROLES_GUI_MIDDLEWARE', 'role:admin'),

    // User Permissions or Role needed to create a new role
    'rolesGuiCreateNewRolesMiddlewareType'   => env('ROLES_GUI_CREATE_ROLE_MIDDLEWARE_TYPE', 'role'), //permissions or roles
    'rolesGuiCreateNewRolesMiddleware'       => env('ROLES_GUI_CREATE_ROLE_MIDDLEWARE_TYPE', 'admin'), // admin, XXX. ... or perms.XXX

    // User Permissions or Role needed to create a new permission
    'rolesGuiCreateNewPermissionMiddlewareType'  => env('ROLES_GUI_CREATE_PERMISSION_MIDDLEWARE_TYPE', 'role'), //permissions or roles
    'rolesGuiCreateNewPermissionsMiddleware'     => env('ROLES_GUI_CREATE_PERMISSION_MIDDLEWARE_TYPE', 'admin'), // admin, XXX. ... or perms.XXX

    // The parent blade file
    'bladeExtended'                 => env('ROLES_GUI_BLADE_EXTENDED', 'layouts.app'),

    // Blade Extension Placement
    'bladePlacement'                => env('ROLES_GUI_BLADE_PLACEMENT', 'yield'),
    'bladePlacementCss'             => env('ROLES_GUI_BLADE_PLACEMENT_CSS', 'inline_template_linked_css'),
    'bladePlacementJs'              => env('ROLES_GUI_BLADE_PLACEMENT_JS', 'inline_footer_scripts'),

    // Titles placement extend
    'titleExtended'                 => env('ROLES_GUI_TITLE_EXTENDED', 'template_title'),

    // Switch Between bootstrap 3 `panel` and bootstrap 4 `card` classes
    'bootstapVersion'               => env('ROLES_GUI_BOOTSTRAP_VERSION', '4'),

    // Additional Card classes for styling -
    // See: https://getbootstrap.com/docs/4.0/components/card/#background-and-color
    // Example classes: 'text-white bg-primary mb-3'
    'bootstrapCardClasses'          => env('ROLES_GUI_CARD_CLASSES', ''),

    // Bootstrap Tooltips
    'tooltipsEnabled'               => env('ROLES_GUI_TOOLTIPS_ENABLED', true),

    // jQuery
    'enablejQueryCDN'               => env('ROLES_GUI_JQUERY_CDN_ENABLED', true),
    'JQueryCDN'                     => env('ROLES_GUI_JQUERY_CDN_URL', 'https://code.jquery.com/jquery-3.3.1.min.js'),

    // Selectize JS
    'enableSelectizeJsCDN'          => env('ROLES_GUI_SELECTIZEJS_CDN_ENABLED', true),
    'SelectizeJsCDN'                => env('ROLES_GUI_SELECTIZEJS_CDN_URL', 'https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/js/standalone/selectize.min.js'),
    'enableSelectizeJs'             => env('ROLES_GUI_SELECTIZEJS_ENABLED', true),
    'enableSelectizeJsCssCDN'       => env('ROLES_GUI_SELECTIZEJS_CSS_CDN_ENABLED', true),
    'SelectizeJsCssCDN'             => env('ROLES_GUI_SELECTIZEJS_CSS_CDN_URL', 'https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/css/selectize.min.css'),

    // Font Awesome
    'enableFontAwesomeCDN'          => env('ROLES_GUI_FONT_AWESOME_CDN_ENABLED', true),
    'fontAwesomeCDN'                => env('ROLES_GUI_FONT_AWESOME_CDN_URL', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'),

    // Flash Messaging
    'builtInFlashMessagesEnabled'   => env('ROLES_GUI_FLASH_MESSAGES_ENABLED', true),

    /*
    |--------------------------------------------------------------------------
    | Laravel Roles API Settings
    |--------------------------------------------------------------------------
    |
    | This is the API for Laravel Roles to be able to CRUD them
    | easily and fast via an API. This is optional and is
    | not needed for your application.
    |
    */
    'rolesApiEnabled'               => env('ROLES_API_ENABLED', false),

    // Enable `auth` middleware
    'rolesAPIAuthEnabled'           => env('ROLES_API_AUTH_ENABLED', true),

    // Enable Roles API middleware
    'rolesAPIMiddlewareEnabled'     => env('ROLES_API_MIDDLEWARE_ENABLED', true),

    // Optional Roles API Middleware
    'rolesAPIMiddleware'            => env('ROLES_API_MIDDLEWARE', 'role:admin'),

    // User Permissions or Role needed to create a new role
    'rolesAPICreateNewRolesMiddlewareType'   => env('ROLES_API_CREATE_ROLE_MIDDLEWARE_TYPE', 'role'), //permissions or roles
    'rolesAPICreateNewRolesMiddleware'       => env('ROLES_API_CREATE_ROLE_MIDDLEWARE_TYPE', 'admin'), // admin, XXX. ... or perms.XXX

    // User Permissions or Role needed to create a new permission
    'rolesAPICreateNewPermissionMiddlewareType'  => env('ROLES_API_CREATE_PERMISSION_MIDDLEWARE_TYPE', 'role'), //permissions or roles
    'rolesAPICreateNewPermissionsMiddleware'     => env('ROLES_API_CREATE_PERMISSION_MIDDLEWARE_TYPE', 'admin'), // admin, XXX. ... or perms.XXX

    /*
    |--------------------------------------------------------------------------
    | Laravel Roles GUI Datatables Settings
    |--------------------------------------------------------------------------
    */

    'enabledDatatablesJs'           => env('ROLES_GUI_DATATABLES_JS_ENABLED', false),
    'datatablesJsStartCount'        => env('ROLES_GUI_DATATABLES_JS_START_COUNT', 25),
    'datatablesCssCDN'              => env('ROLES_GUI_DATATABLES_CSS_CDN', 'https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css'),
    'datatablesJsCDN'               => env('ROLES_GUI_DATATABLES_JS_CDN', 'https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js'),
    'datatablesJsPresetCDN'         => env('ROLES_GUI_DATATABLES_JS_PRESET_CDN', 'https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js'),

    /*
    |--------------------------------------------------------------------------
    | Laravel Roles Package Integration Settings
    |--------------------------------------------------------------------------
    */

    'laravelUsersEnabled'           => env('ROLES_GUI_LARAVEL_ROLES_ENABLED', false),
];

Environment File

# Roles Default Models
ROLES_DEFAULT_USER_MODEL=App\User
ROLES_DEFAULT_ROLE_MODEL=jeremykenedy\LaravelRoles\Models\Role
ROLES_DEFAULT_PERMISSION_MODEL=jeremykenedy\LaravelRoles\Models\Permission

# Roles database information
ROLES_DATABASE_CONNECTION=null
ROLES_ROLES_DATABASE_TABLE=roles
ROLES_ROLE_USER_DATABASE_TABLE=role_user
ROLES_PERMISSIONS_DATABASE_TABLE=permissions
ROLES_PERMISSION_ROLE_DATABASE_TABLE=permission_role
ROLES_PERMISSION_USER_DATABASE_TABLE=permission_user

# Roles Misc Settings
ROLES_DEFAULT_SEPARATOR='.'

# Roles Database Migrations Settings
ROLES_MIGRATION_DEFAULT_ENABLED=true

# Roles Database Seeder Settings
ROLES_SEED_DEFAULT_PERMISSIONS=true
ROLES_SEED_DEFAULT_ROLES=true
ROLES_SEED_DEFAULT_RELATIONSHIPS=true
ROLES_SEED_DEFAULT_USERS=false

# Roles GUI Settings
ROLES_GUI_ENABLED=false
ROLES_GUI_AUTH_ENABLED=true
ROLES_GUI_MIDDLEWARE_ENABLED=true
ROLES_GUI_MIDDLEWARE='role:admin'
ROLES_GUI_CREATE_ROLE_MIDDLEWARE_TYPE='role'
ROLES_GUI_CREATE_ROLE_MIDDLEWARE_TYPE='admin'
ROLES_GUI_CREATE_PERMISSION_MIDDLEWARE_TYPE='role'
ROLES_GUI_CREATE_PERMISSION_MIDDLEWARE_TYPE='admin'
ROLES_GUI_BLADE_EXTENDED='layouts.app'
ROLES_GUI_TITLE_EXTENDED='template_title'
ROLES_GUI_LARAVEL_ROLES_ENABLED=false
ROLES_GUI_TOOLTIPS_ENABLED=true
ROLES_GUI_DATATABLES_JS_ENABLED=false

More Information

For more information, please have a look at HasRoleAndPermission contract.

Optional GUI Routes

+--------+-----------+---------------------------------+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------+---------------------+
| Domain | Method    | URI                             | Name                                          | Action                                                                                                          | Middleware          |
+--------+-----------+---------------------------------+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------+---------------------+
|        | GET|HEAD  | permission-deleted/{id}         | laravelroles::permission-show-deleted         | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelpermissionsDeletedController@show                         | web,auth,role:admin |
|        | DELETE    | permission-destroy/{id}         | laravelroles::permission-item-destroy         | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelpermissionsDeletedController@destroy                      | web,auth,role:admin |
|        | PUT       | permission-restore/{id}         | laravelroles::permission-restore              | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelpermissionsDeletedController@restorePermission            | web,auth,role:admin |
|        | POST      | permissions                     | laravelroles::permissions.store               | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelPermissionsController@store                               | web,auth,role:admin |
|        | GET|HEAD  | permissions                     | laravelroles::permissions.index               | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelPermissionsController@index                               | web,auth,role:admin |
|        | GET|HEAD  | permissions-deleted             | laravelroles::permissions-deleted             | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelpermissionsDeletedController@index                        | web,auth,role:admin |
|        | DELETE    | permissions-deleted-destroy-all | laravelroles::destroy-all-deleted-permissions | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelpermissionsDeletedController@destroyAllDeletedPermissions | web,auth,role:admin |
|        | POST      | permissions-deleted-restore-all | laravelroles::permissions-deleted-restore-all | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelpermissionsDeletedController@restoreAllDeletedPermissions | web,auth,role:admin |
|        | GET|HEAD  | permissions/create              | laravelroles::permissions.create              | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelPermissionsController@create                              | web,auth,role:admin |
|        | PUT|PATCH | permissions/{permission}        | laravelroles::permissions.update              | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelPermissionsController@update                              | web,auth,role:admin |
|        | GET|HEAD  | permissions/{permission}        | laravelroles::permissions.show                | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelPermissionsController@show                                | web,auth,role:admin |
|        | DELETE    | permissions/{permission}        | laravelroles::permissions.destroy             | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelPermissionsController@destroy                             | web,auth,role:admin |
|        | GET|HEAD  | permissions/{permission}/edit   | laravelroles::permissions.edit                | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelPermissionsController@edit                                | web,auth,role:admin |
|        | GET|HEAD  | role-deleted/{id}               | laravelroles::role-show-deleted               | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelRolesDeletedController@show                               | web,auth,role:admin |
|        | DELETE    | role-destroy/{id}               | laravelroles::role-item-destroy               | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelRolesDeletedController@destroy                            | web,auth,role:admin |
|        | PUT       | role-restore/{id}               | laravelroles::role-restore                    | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelRolesDeletedController@restoreRole                        | web,auth,role:admin |
|        | POST      | roles                           | laravelroles::roles.store                     | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelRolesController@store                                     | web,auth,role:admin |
|        | GET|HEAD  | roles                           | laravelroles::roles.index                     | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelRolesController@index                                     | web,auth,role:admin |
|        | GET|HEAD  | roles-deleted                   | laravelroles::roles-deleted                   | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelRolesDeletedController@index                              | web,auth,role:admin |
|        | DELETE    | roles-deleted-destroy-all       | laravelroles::destroy-all-deleted-roles       | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelRolesDeletedController@destroyAllDeletedRoles             | web,auth,role:admin |
|        | POST      | roles-deleted-restore-all       | laravelroles::roles-deleted-restore-all       | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelRolesDeletedController@restoreAllDeletedRoles             | web,auth,role:admin |
|        | GET|HEAD  | roles/create                    | laravelroles::roles.create                    | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelRolesController@create                                    | web,auth,role:admin |
|        | DELETE    | roles/{role}                    | laravelroles::roles.destroy                   | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelRolesController@destroy                                   | web,auth,role:admin |
|        | PUT|PATCH | roles/{role}                    | laravelroles::roles.update                    | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelRolesController@update                                    | web,auth,role:admin |
|        | GET|HEAD  | roles/{role}                    | laravelroles::roles.show                      | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelRolesController@show                                      | web,auth,role:admin |
|        | GET|HEAD  | roles/{role}/edit               | laravelroles::roles.edit                      | jeremykenedy\LaravelRoles\App\Http\Controllers\LaravelRolesController@edit                                      | web,auth,role:admin |
+--------+-----------+---------------------------------+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------+---------------------+

Screen Shots

Laravel Roles GUI Dashboard Laravel Roles GUI Create New Role Laravel Roles GUI Edit Role Laravel Roles GUI Show Role Laravel Roles GUI Delete Role Laravel Roles GUI Success Deleted Laravel Roles GUI Deleted Role Show Laravel Roles GUI Restore Role Laravel Roles GUI Delete Permission Laravel Roles GUI Show Permission Laravel Roles GUI Permissions Dashboard Laravel Roles GUI Create New Permission Laravel Roles GUI Roles Soft Deletes Dashboard Laravel Roles GUI Permissions Soft Deletes Dashboard Laravel Roles GUI Success Restore

File Tree

β”œβ”€β”€ .env.example
β”œβ”€β”€ .env.travis
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .travis.yml
β”œβ”€β”€ LICENSE
β”œβ”€β”€ composer.json
β”œβ”€β”€ phpunit.xml
β”œβ”€β”€ readme.md
└── src
    β”œβ”€β”€ App
    β”‚Β Β  β”œβ”€β”€ Exceptions
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ AccessDeniedException.php
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ LevelDeniedException.php
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ PermissionDeniedException.php
    β”‚Β Β  β”‚Β Β  └── RoleDeniedException.php
    β”‚Β Β  β”œβ”€β”€ Http
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Controllers
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Api
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”‚Β Β  └── LaravelRolesApiController.php
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ LaravelPermissionsController.php
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ LaravelRolesController.php
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ LaravelRolesDeletedController.php
    β”‚Β Β  β”‚Β Β  β”‚Β Β  └── LaravelpermissionsDeletedController.php
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Middleware
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ VerifyLevel.php
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ VerifyPermission.php
    β”‚Β Β  β”‚Β Β  β”‚Β Β  └── VerifyRole.php
    β”‚Β Β  β”‚Β Β  └── Requests
    β”‚Β Β  β”‚Β Β      β”œβ”€β”€ StorePermissionRequest.php
    β”‚Β Β  β”‚Β Β      β”œβ”€β”€ StoreRoleRequest.php
    β”‚Β Β  β”‚Β Β      β”œβ”€β”€ UpdatePermissionRequest.php
    β”‚Β Β  β”‚Β Β      └── UpdateRoleRequest.php
    β”‚Β Β  └── Services
    β”‚Β Β      β”œβ”€β”€ PermissionFormFields.php
    β”‚Β Β      └── RoleFormFields.php
    β”œβ”€β”€ Contracts
    β”‚Β Β  β”œβ”€β”€ HasRoleAndPermission.php
    β”‚Β Β  β”œβ”€β”€ PermissionHasRelations.php
    β”‚Β Β  └── RoleHasRelations.php
    β”œβ”€β”€ Models
    β”‚Β Β  β”œβ”€β”€ Permission.php
    β”‚Β Β  └── Role.php
    β”œβ”€β”€ RolesFacade.php
    β”œβ”€β”€ RolesServiceProvider.php
    β”œβ”€β”€ Traits
    β”‚Β Β  β”œβ”€β”€ DatabaseTraits.php
    β”‚Β Β  β”œβ”€β”€ HasRoleAndPermission.php
    β”‚Β Β  β”œβ”€β”€ PermissionHasRelations.php
    β”‚Β Β  β”œβ”€β”€ RoleHasRelations.php
    β”‚Β Β  β”œβ”€β”€ RolesAndPermissionsHelpersTrait.php
    β”‚Β Β  β”œβ”€β”€ RolesUsageAuthTrait.php
    β”‚Β Β  └── Slugable.php
    β”œβ”€β”€ config
    β”‚Β Β  └── roles.php
    β”œβ”€β”€ database
    β”‚Β Β  β”œβ”€β”€ Migrations
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 2016_01_15_105324_create_roles_table.php
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 2016_01_15_114412_create_role_user_table.php
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 2016_01_26_115212_create_permissions_table.php
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 2016_01_26_115523_create_permission_role_table.php
    β”‚Β Β  β”‚Β Β  └── 2016_02_09_132439_create_permission_user_table.php
    β”‚Β Β  └── Seeds
    β”‚Β Β      β”œβ”€β”€ DefaultConnectRelationshipsSeeder.php
    β”‚Β Β      β”œβ”€β”€ DefaultPermissionsTableSeeder.php
    β”‚Β Β      β”œβ”€β”€ DefaultRolesTableSeeder.php
    β”‚Β Β      β”œβ”€β”€ DefaultUsersTableSeeder.php
    β”‚Β Β      └── publish
    β”‚Β Β          β”œβ”€β”€ ConnectRelationshipsSeeder.php
    β”‚Β Β          β”œβ”€β”€ PermissionsTableSeeder.php
    β”‚Β Β          β”œβ”€β”€ RolesTableSeeder.php
    β”‚Β Β          └── UsersTableSeeder.php
    β”œβ”€β”€ resources
    β”‚Β Β  β”œβ”€β”€ lang
    β”‚Β Β  β”‚Β Β  └── en
    β”‚Β Β  β”‚Β Β      └── laravelroles.php
    β”‚Β Β  └── views
    β”‚Β Β      └── laravelroles
    β”‚Β Β          β”œβ”€β”€ cards
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ permissions-card.blade.php
    β”‚Β Β          β”‚Β Β  └── roles-card.blade.php
    β”‚Β Β          β”œβ”€β”€ crud
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ dashboard.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ permissions
    β”‚Β Β          β”‚Β Β  β”‚Β Β  β”œβ”€β”€ create.blade.php
    β”‚Β Β          β”‚Β Β  β”‚Β Β  β”œβ”€β”€ deleted
    β”‚Β Β          β”‚Β Β  β”‚Β Β  β”‚Β Β  └── index.blade.php
    β”‚Β Β          β”‚Β Β  β”‚Β Β  β”œβ”€β”€ edit.blade.php
    β”‚Β Β          β”‚Β Β  β”‚Β Β  └── show.blade.php
    β”‚Β Β          β”‚Β Β  └── roles
    β”‚Β Β          β”‚Β Β      β”œβ”€β”€ create.blade.php
    β”‚Β Β          β”‚Β Β      β”œβ”€β”€ deleted
    β”‚Β Β          β”‚Β Β      β”‚Β Β  └── index.blade.php
    β”‚Β Β          β”‚Β Β      β”œβ”€β”€ edit.blade.php
    β”‚Β Β          β”‚Β Β      └── show.blade.php
    β”‚Β Β          β”œβ”€β”€ forms
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ create-permission-form.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ create-role-form.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ delete-sm.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ destroy-all-permissions.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ destroy-all-roles.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ destroy-sm.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ edit-permission-form.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ edit-role-form.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ partials
    β”‚Β Β          β”‚Β Β  β”‚Β Β  β”œβ”€β”€ permission-desc-input.blade.php
    β”‚Β Β          β”‚Β Β  β”‚Β Β  β”œβ”€β”€ permission-name-input.blade.php
    β”‚Β Β          β”‚Β Β  β”‚Β Β  β”œβ”€β”€ permission-slug-input.blade.php
    β”‚Β Β          β”‚Β Β  β”‚Β Β  β”œβ”€β”€ permissions-model-select.blade.php
    β”‚Β Β          β”‚Β Β  β”‚Β Β  β”œβ”€β”€ role-desc-input.blade.php
    β”‚Β Β          β”‚Β Β  β”‚Β Β  β”œβ”€β”€ role-level-input.blade.php
    β”‚Β Β          β”‚Β Β  β”‚Β Β  β”œβ”€β”€ role-name-input.blade.php
    β”‚Β Β          β”‚Β Β  β”‚Β Β  β”œβ”€β”€ role-permissions-select.blade.php
    β”‚Β Β          β”‚Β Β  β”‚Β Β  └── role-slug-input.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ permission-form.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ restore-all-permissions.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ restore-all-roles.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ restore-item.blade.php
    β”‚Β Β          β”‚Β Β  └── role-form.blade.php
    β”‚Β Β          β”œβ”€β”€ modals
    β”‚Β Β          β”‚Β Β  └── confirm-modal.blade.php
    β”‚Β Β          β”œβ”€β”€ partials
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ bs-visibility-css.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ flash-messages.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ form-status.blade.php
    β”‚Β Β          β”‚Β Β  └── styles.blade.php
    β”‚Β Β          β”œβ”€β”€ scripts
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ confirm-modal.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ datatables.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ form-inputs-helpers.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ selectize.blade.php
    β”‚Β Β          β”‚Β Β  β”œβ”€β”€ selectizePermission.blade.php
    β”‚Β Β          β”‚Β Β  └── tooltips.blade.php
    β”‚Β Β          └── tables
    β”‚Β Β              β”œβ”€β”€ permission-items-table.blade.php
    β”‚Β Β              β”œβ”€β”€ permissions-table.blade.php
    β”‚Β Β              β”œβ”€β”€ role-items-table.blade.php
    β”‚Β Β              └── roles-table.blade.php
    └── routes
        β”œβ”€β”€ api.php
        └── web.php
  • Tree command can be installed using brew: brew install tree
  • File tree generated using command tree -a -I '.git|node_modules|vendor|storage|tests'

Opening an Issue

Before opening an issue there are a couple of considerations:

  • You are all awesome!
  • Read the instructions and make sure all steps were followed correctly.
  • Check that the issue is not specific to your development environment setup.
  • Provide duplication steps.
  • Attempt to look into the issue, and if you have a solution, make a pull request.
  • Show that you have made an attempt to look into the issue.
  • Check to see if the issue you are reporting is a duplicate of a previous reported issue.
  • Following these instructions show me that you have tried.
  • If you have a questions send me an email to [email protected]
  • Need some help, I can do my best on Slack: https://opensourcehelpgroup.slack.com
  • Please be considerate that this is an open source project that I provide to the community for FREE when opening an issue.

Credit Note:

The HasRoleAndPermission Trait And Contract is and an adaptation of romanbican/roles. I liked the method he made so I used them.

License

This package is free software distributed under the terms of the MIT license. Enjoy!

More Repositories

1

laravel-auth

Laravel 10 with user authentication, registration with email confirmation, social media authentication, password recovery, and captcha protection. Uses offical [Bootstrap 4](http://getbootstrap.com). This also makes full use of Controllers for the routes, templates for the views, and makes use of middleware for routing. 5 Minutes Stand-up time.
JavaScript
2,924
star
2

laravel-logger

An out the box activity logger for your Laravel or Lumen application. Laravel logger is an activity event logger for your laravel application. It comes out the box with ready to use with dashboard to view your activity. Laravel logger can be added as a middleware or called through a trait. This package is easily configurable and customizable. Supports Laravel 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6, and 7+
PHP
494
star
3

laravel-users

A Users Management Package that includes all necessary routes, views, models, and controllers for a user management dashboard and associated pages for managing Laravels built in user scaffolding. Built for Laravel 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6.0, 7.0 and 8.0.
Blade
402
star
4

laravel-material-design

Laravel 5.6 on Material Design Lite 1.3 with user authentication, registration with email confirmation, social media authentication, password recovery, and captcha protection. This makes full use of Controllers for the routes, templates for the views, and makes use of middleware for routing. Uses laravel ORM modeling and has CRUD (Create Read Update Delete) functionality for all tasks. Quick setup, can be done in 5 minutes. It will take longer to obtain your Facebook, Twitter, and Google Plus API Keys than it will to set this up.
JavaScript
260
star
5

laravel2step

Laravel 2-Step verification is a package to add 2-Step user authentication to any Laravel project easily. It is configurable and customizable. It uses notifications to send the user an email with a 4-digit verification code. Laravel 2-Step Authentication Verification for Laravel. Can be used in out the box with Laravel's authentication scaffolding or integrated into other projects.
PHP
213
star
6

larablog

A powerful open source Laravel Blog with WYSWYG and CRUD (Create Read Update Delete) built on Laravel 5.8 and Bootstrap 4
PHP
146
star
7

laravel-exception-notifier

Laravel Exception Notifier will send an email of the error along with the stack trace to the chosen recipients. This Package includes all necessary traits, views, configs, and Mailers for email notifications upon your applications exceptions. You can customize who send to, cc to, bcc to, enable/disable, and custom subject or default subject based on environment. Built for Laravel 5.2, 5.3, 5.4, 5.5+. Get the errors and fix them before the client even reports them, that's why this exists! For Laravel 5, 6, and 7
PHP
125
star
8

laravel-spa

A Laravel + Socialite + Vite + Vue 3 + TailwindCSS SPA Boilerplate with user authentication, registration, email verification, social media authentication, password recovery, user management, and roles/permissions management. Uses TailwindCSS. While the front end is part of this repository it is a completely separated Vue 3 front end.
JavaScript
98
star
9

laravel-blocker

Larave Blocker is a middleware interface to block users, emails, ip addresses, domain names, cities, states, countries, continents, and regions from using your application, logging in, or registering. The types of items to be blocked can be extended to what you think via a seed. The items you are blocking have a CRUD interface along with a softdeletes interface.
Blade
92
star
10

laravel-admin

Laravel 5.2 + Bootstrap 3.5 + AdminLTE 2.3
JavaScript
61
star
11

slack-laravel

Laravel integration for the Slack, including facades and service providers.
PHP
55
star
12

laravel-phpinfo

Laravel PHP Info is a package that provides a PHPInfo() page using blade templating. The config file can be used to enable/disable auth protection and specify the roles middleware.
PHP
44
star
13

laravel-podcast

Laravel Podcast is Laravel 5.5 web app that enables you to manage RSS feeds for your favorite podcasts and listen to the episodes in a seamless UI and User Authentication.
PHP
38
star
14

laravel-https

Laravel Https is middleware to check for Secure HTTP requests. Laravel Https has can check for HTTPS and throw an error or automatically redirect to HTTPS.
PHP
34
star
15

laravel-tasks

An app of tasks lists for each individual user. Built on Laravel 5.2, using 5.2 authentication and middleware. This has robust verbose examples using Laravel best practices. The task list is a build out of https://laravel.com/docs/5.2/quickstart. This included minimal bootstrap implementation.
PHP
26
star
16

laravel-time-tracker

Laravel Angular Time Tracker is a simple time tracking application built on Laravel 5.2, Angular 2, and Bootstrap 3. It uses Laravel's built in authentication, MySQL, Angular Bootstrap 1.3.*, Angular Resource 1.5.* ngResource, jQuery 2.2.4 and Moment.js 2.13.*
PHP
25
star
17

laravel-soundboard

An open source Laravel Soundboard with Admin Panel CRUD (Create Read Update Delete) built on Laravel, Bootstrap, and Vue.js
PHP
24
star
18

laravel-uuid

Laravel package to generate a UUID according to the RFC 4122 standard. UUID Versions 1, 3, 4 and 5 are supported.
PHP
22
star
19

laravelpodcast

Laravel Podcast Manager is a complete podcast manager package for Laravel 5.3+ that enables you to manage RSS feeds for your favorite podcasts and listen to the episodes in a seamless UI.
CSS
22
star
20

laravel-dashboard

This is an example of Spatie Laravel Dashboard using Livewire and package components. This example has all settings extended to the `dashboard.php` config file and the `.env` file. This example uses minimal styling and customization.
PHP
14
star
21

laravel-passport

Laravel-passport is a basic API server build using Laravel, Passport, and Vue.js License Build Status This will act as the API server for laravel-consume. It is recommended that you setup and use Laravel Homestead as your development environment for this project. Personal Token Scoped with middleware for API routes is configured and ready to go. Included Laravel Scaffolding User, Editor, and Administrator Authentication with CRUD (Create, Read, Update, Delete) user management.
PHP
11
star
22

slack

A simple PHP package for sending messages to Slack.
PHP
9
star
23

laravel-pusher-chat

Example of chat messaging system with pusher and Eloquent
HTML
8
star
24

laravel-nerds

A Laravel 5.1 ORM example with Nerds as users.
PHP
7
star
25

laravel-email-database-log

A database logger for all outgoing emails sent by your Laravel application.
PHP
6
star
26

laravel-roles-example

An example of jeremykenedy/laravel-roles, a Laravel 5.4+ roles package.
PHP
6
star
27

laravel-packagist

An easy way to get vendor and package data from Packagist via API calls
PHP
5
star
28

microsoft-powerbi-javascript-example

Microsoft Power BI is a suite of business analytics tools that deliver insights throughout your organization. This is an example of the powerbi-client API javascript embeded interface.
JavaScript
5
star
29

jquery-ui-position-sql-save

Save position and resize properties of jQuery UI to a SQL table.
JavaScript
4
star
30

laravel-consumer

PHP
3
star
31

bootstrap-youtube-modal-plugin

Bootstap YouTube video modal helper, with auto video switcher to modal.
HTML
3
star
32

konami-asteroids

Use the Konami code to easily add a playable Astroids game to a page using the html as the game
JavaScript
3
star
33

laravel-todo

PHP
2
star
34

jeremy-sound-board

Set of wav files for the soundboard
2
star
35

laravel-charts

PHP
2
star
36

pushit

Salt and Pepper Push on Git Push - Or whatever mp3 you like. Basic bash shell-script calling git and afplay commands. The file mp3 file name and path are in a variable for easy maintenance and reusability for more alias's, you can also create more variables for other mp3's as well as just call them directly in your alias. This is pretty light weight and strait forward. The mp3 file was trimmed with quicktime and is being played with the native mac os (maybe linux? confirm?) player. The mp3 file is 274KB and the the attached shell script (sh) file is B. You can can the script file using the sh command or directly add the contents into your bash profile. Have fun !!!!! :)
Shell
2
star
37

hiupload-client

Vue
1
star
38

laravel_frozennode_cms

JavaScript
1
star
39

jeremykenedy

1
star
40

laravel-react-tasks

Simple create/read/update task list example using Laravel 5.7 API routes and ReactJS UI.
PHP
1
star
41

laravel-react-products

Simple products Create/Read example using Laravel 5.7 and ReactJS UI.
PHP
1
star
42

polr2

PHP
1
star
43

yt-video-gallery

jquery youtube video gallery plugin
JavaScript
1
star
44

pure-javascript-sorting

An example of sorting records with pure javascript.
HTML
1
star
45

action-planner-example

Example
PHP
1
star
46

zoom-care-events

A simple fully expandable Node.js app that takes JSON data and renders it in a MVC style setup with Express.js
CSS
1
star
47

laravel.local

An out the Box Laravel Installation with Auth scaffolding - For example purposes.
PHP
1
star
48

hiupload-api

PHP
1
star
49

crudbooster-example

PHP
1
star
50

angular-js-bootstrap-scss

This is an example of a front end application using Angular.js.
JavaScript
1
star
51

jeremykenedy.github.io

CSS
1
star
52

taco-time

Simple example Laravel 5.7 app to calculate taco checkout time using a VueJS 2 front end calling Laravel API endpoints.
PHP
1
star
53

laralogin

Laravel 5.1 with authentication and User/Admin MIddlware. Purely based on Laravel 5.1 documentations located at http://laravel.com/docs/5.1/authentication.
PHP
1
star
54

timezones

This is a base example of a laravel package. The focus is on the framework of the package and the essential elements and not so much what it actually does. It returns the time and date in a Laravel application when going to the the URL /timezones/{TIMEZONE} from the projects base url.
HTML
1
star
55

vue-cordova-ratchet

A Template created with vue cli and vue-cordova. This will compile using to IOS, Android, Electron, and OSX native all from the cli out the box!
Objective-C
1
star
56

resize-listener

A pure javascript resize listener, checks on page load and on every window resize. Handy for scripts and functions that need to run on mobile but not desktop or vice versa.
JavaScript
1
star