We use good number of packages to provide great functionality without re-inventing wheel.
We need to add those packages to
composer.json, publish vendor configurations and finally do migrations.
Delete existing migration files
Since we are not relying on default migration tables, please remove following two files from
Otherwise you will get error at later stage of installation.
Chandra ships with two middlewares one for admin and another for user.
To be able to use them, we should define them in
app\Http\Kernel.php and in
$routeMiddleware add following
'SentinelUser' => \App\Http\Middleware\SentinelUser::class, 'SentinelAdmin' => \App\Http\Middleware\SentinelAdmin::class,
Add Package to composer
Now add above mentioned packages in
"cartalyst/sentinel": "2.0.*", "laravelcollective/html": "5.1.*", "cviebrock/eloquent-sluggable": "dev-master", "cviebrock/eloquent-taggable": "dev-master",
composer update in terminal to download above packages.
Add service providers
config/app.php and add following lines in the
Cartalyst\Sentinel\Laravel\SentinelServiceProvider::class, Collective\Html\HtmlServiceProvider::class, Cviebrock\EloquentSluggable\SluggableServiceProvider::class, Cviebrock\EloquentTaggable\ServiceProvider::class,
$aliases array add following facades
'Activation' => Cartalyst\Sentinel\Laravel\Facades\Activation::class, 'Reminder' => Cartalyst\Sentinel\Laravel\Facades\Reminder::class, 'Sentinel' => Cartalyst\Sentinel\Laravel\Facades\Sentinel::class, 'Form' => Collective\Html\FormFacade::class, 'Html' => Collective\Html\HtmlFacade::class,
now we need to publish vendor files so that they will publish config files, migrations.
Excecute following command in command prompt/terminal
php artisan taggable:table php artisan vendor:publish
Now we need to add user, groups etc tables to database, to do so in your command prompt, execute following code
php artisan migrate
Note: please check all files in
database\migrations to know what fields are being added.
setting up config to use our model
since we have different requirements (extra fields in users table), we need to change sentinel config to use our user Model,
to do that open
at line 56, find
'model' => 'Cartalyst\Sentinel\Users\EloquentUser',
replace it with
'model' => 'App\User',
Add admin user
As database tables have been setup, we need to add admin user to be able to login into adminCP.
Run following command in your command prompt
php artisan db:seed --class=AdminSeeder
A default admin user with user with username firstname.lastname@example.org and password admin will be created
Optional: If you wish to use a different username or password, please open
database\seeds\AdminSeeder.php and edit values around lines 14-18
upload directory permissions
user's profile pics will be uploaded into
so we need to provide write access for that folder
to do so, please run following command in your command prompt/terminal
chmod 775 public/uploads/users chmod 775 public/uploads/blog