Role package for Laravel 5
36
2
3
Package Data
Maintainer Username: bobbybouwmann
Maintainer Contact: bobbybouwmann@gmail.com (Bobby Bouwmann)
Package Create Date: 2015-02-19
Package Last Update: 2015-02-20
Language: PHP
License: MIT
Last Refreshed: 2024-04-23 03:08:03
Package Statistics
Total Downloads: 36
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 2
Total Watchers: 3
Total Forks: 3
Total Open Issues: 0

Entry by Sebwite

Entry is a role package for Laravel5.

Setup

In the require key of composer add the following

"blackbirddev/entry": "dev-master"

The next step is to update/install with composer

$ composer update

Open up your config/app.php file and add this at the end of the $providers array:

'Blackbirddev\Entry\EntryServiceProvider',

In the same file add the facade at the end gof the $aliases array:

'Entry      => 'Blackbirddev\Entry\EntryFacade',

The next step is to add the migration, models, seeds and config files to your project. To do this run this command:

$ php artisan vendor:publish --provider="Blackbirddev\Entry\EntryServiceProvider"

Note: This function generates the models but it does NOT generate the correct namespace for you. If you changed the default namespace then you need to update the namespace in the Role and Permission model in the app directory!


Models

User (App\User.php)

We need to update the user model with a trait. Your model should now look like this:

use Blackbird\Entry\Entry\EntryUserTrait;
 
class User extends Model implements AuthenticatableContract, CanResetPasswordContract {
 
    use Authenticatable, CanResetPassword, EntryUserTrait;
 
    // Your other stuff
    ...
 
}

Note: It's important that the use statement is added to your User model


Middleware

Open up your app/Http/Kernel.app file and add the package middleware to the $middleware` array like so:

protected $middleware = [
    // ...
    'App\Http\Middleware\VerifyCsrfToken',
    
    'Blackbirddev\Entry\Middleware\CheckPermission',
];

You need to do a composer dump-autoload to make the middleware available ;)


Database

Let's get that database ready

We need to make sure that we have all the databases and the data for that. Let's first migrate.

$ php artisan migrate

Finally some data

We need to seed the database with the new seeder class that is created in the migrations directory

$ php artisan db:seed --class=EntryDatabaseSeeder

Note: If you can't run the seed then run composer dump-autoload first