2017 © Pedro Peláez
 

project regulator

Auth and role/permissions manager

image

jameron/regulator

Auth and role/permissions manager

  • Wednesday, January 31, 2018
  • by Jameron
  • Repository
  • 1 Watchers
  • 1 Stars
  • 92 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 59 Versions
  • 0 % Grown

The README.md

This package has been built to work with Laravel 5.4.33 and later. (Some older versions of Laravel may not be compatible.), (*1)

This package contains methods and traits that can be used with your project, and optionally you can use the views for your UX. If you are using the admin views, make sure you also require the admin package found here: Admin package, (*2)

Your composer file would look like so:, (*3)

        "jameron/admin": "*",
        "jameron/regulator": "*",

Let's see if we can't get you up and running in 10 steps. If you are starting fresh, create your laravel application first thing:, (*4)

composer create-project --prefer-dist laravel/laravel blog

1) Add the package to your compose.json file:, (*5)

    "jameron/regulator": "*",
composer update

**NOTE Laravel 5.5+ users there is auto-discovery so you can ignore steps 2 and 3, (*6)

2) Update your providers:, (*7)

        Jameron\Regulator\RegulatorServiceProvider::class,

3) Update your Facades:, (*8)

        'Regulator' => Jameron\Regulator\Facades\RegulatorFacade::class,

4) Publish the sass, js, and config:, (*9)

php artisan vendor:publish

**NOTE: Select the number that coorelates to the jameron/regulator package, (*10)

5) Run your migrations:, (*11)

**NOTE: the Regulator package depends on Laravel Auth so if you haven't set it up yet run:, (*12)

php artisan make:auth

**NOTE: DELETE the Auth::routes() from routes/web.php, the Regulator package includes these routes for you., (*13)

Alright now go ahead and migrate:, (*14)

php artisan migrate

If you get this error, (*15)

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`))``` 

You need to add this to your AppServiceProvider, (*16)

use Illuminate\Support\Facades\Schema;

function boot()
{
    Schema::defaultStringLength(191);
}

6) Seed up the database with two roles and a few permissions, (*17)

You can call it directly via command line or add it to your applications seeder file:, (*18)

Added to application seeder, (*19)

database/seeds/DatabaseSeeder.php, (*20)

$this->call(\Jameron\Regulator\database\seeds\RegulatorSeeder::class);

Called via command line:, (*21)

php artisan db:seed --class=\\Jameron\\Regulator\\database\\seeds\\RegulatorSeeder, (*22)

7) Update your App\User.php, (*23)


use Jameron\Regulator\Models\Traits\HasRoles; class User extends Authenticatable { use HasRoles;

You will also want these methods on your User model, (*24)

    public function getRoleAttribute()
    {
        $roles = [];
        foreach($this->roles()->get() as $role) {
            $roles[] = $role->slug;
        }
        return implode(',', $roles);
    } 

    public function getEnabledAttribute()
    {
        return ($this->disabled) ? 'no' : 'yes';
    }

8) If you setup you project to use the database driver for sessions you can see when users are logged in or not. To set up the database session driver:, (*25)


php artisan session:table php artisan migrate

9) Subscribe to the login and logout events to update the users last_login and last_logout timestamp on the user model. Add this to app/Providers/EventServiceProvider., (*26)

protected $subscribe = [
\Jameron\Regulator\Listeners\UserEventSubscriber::class,
];

9) Update your webpack.mix.js file, (*27)

   .js('resources/assets/regulator/js/RegulatorDependencies.js', 'public/js/Regulator.js')
   .sass('resources/assets/regulator/sass/regulator.scss', 'public/css')

10) Make sure you have vuex installed, it is used with the role permissions component., (*28)

npm install vuex --save

11) Compile it up:, (*29)

npm run dev

The Versions

31/01 2018

dev-master

9999999-dev http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

31/01 2018

2.4.8

2.4.8.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

16/01 2018

2.4.7

2.4.7.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

16/01 2018

2.4.6

2.4.6.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

16/01 2018

2.4.5

2.4.5.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

16/01 2018

2.4.4

2.4.4.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

16/01 2018

2.4.3

2.4.3.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

13/01 2018

2.4.2

2.4.2.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

12/01 2018

2.4.1

2.4.1.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

12/01 2018

2.4.0

2.4.0.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

12/01 2018

2.3.9

2.3.9.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

11/01 2018

2.3.8

2.3.8.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

11/01 2018

2.3.6

2.3.6.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

11/01 2018

2.3.5

2.3.5.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

11/01 2018

2.3.4

2.3.4.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

11/01 2018

2.3.3

2.3.3.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

10/01 2018

2.3.2

2.3.2.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

04/01 2018

2.3.1

2.3.1.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

28/12 2017

2.3.0

2.3.0.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

28/12 2017

2.2.9

2.2.9.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

28/12 2017

2.2.8

2.2.8.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

27/12 2017

2.2.7

2.2.7.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

20/12 2017

2.2.6

2.2.6.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

20/12 2017

2.2.5

2.2.5.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

20/12 2017

2.2.4

2.2.4.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

19/12 2017

2.2.3

2.2.3.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

19/12 2017

2.2.2

2.2.2.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

16/12 2017

2.2.1

2.2.1.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

13/12 2017

2.2.0

2.2.0.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

13/12 2017

2.1.9

2.1.9.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

04/12 2017

2.1.8

2.1.8.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

04/12 2017

2.1.7

2.1.7.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

04/12 2017

2.1.6

2.1.6.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

04/12 2017

2.1.5

2.1.5.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

04/12 2017

2.1.4

2.1.4.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

04/12 2017

2.1.3

2.1.3.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

04/12 2017

2.1.2

2.1.2.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

04/12 2017

2.1.1

2.1.1.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

04/12 2017

2.1.0

2.1.0.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

17/11 2017

2.0.9

2.0.9.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

16/11 2017

2.0.8

2.0.8.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

16/11 2017

2.0.7

2.0.7.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

16/11 2017

2.0.6

2.0.6.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

16/11 2017

2.0.5

2.0.5.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

16/11 2017

2.0.4

2.0.4.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

13/11 2017

2.0.3

2.0.3.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

10/11 2017

2.0.2

2.0.2.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

09/11 2017

2.0.1

2.0.1.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

09/11 2017

2.0.0

2.0.0.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

09/11 2017

1.0.9

1.0.9.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

09/11 2017

1.0.8

1.0.8.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

09/11 2017

1.0.7

1.0.7.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

09/11 2017

1.0.6

1.0.6.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

08/11 2017

1.0.5

1.0.5.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

08/11 2017

1.0.4

1.0.4.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

07/11 2017

1.0.3

1.0.3.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

07/11 2017

1.0.2

1.0.2.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

07/11 2017

1.0.1

1.0.1.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms

07/11 2017

1.0.0

1.0.0.0 http://cjmacfarlane.com

Auth and role/permissions manager

  Sources   Download

MIT

by Cameron Macfarlane

roles permissions lms