Skip to main content
Image for post: Installing Laravel Voyager admin panel

Installing Laravel Voyager admin panel

The correct procedure

I have recently had a couple of small problems installing the Laravel Voyager admin panel. It works specifically with Laravel 5.3 and this can be a disadvantage. If you use Voyager, probably you will not upgrade your Larvel installation or you will have a lot of troubles if you do it! But don't worry: Laravel 5.3 is great and you can have a lot of features available for your project. Let's see the correct procedure and how to install Voyager correctly from scratch.

Install Laravel 5.3 forcing the specific version with composer;


composer create-project --prefer-dist laravel/laravel laravel-voyager "5.3.*"

Now you have a new directory with all your files including the vendor directory. Go inside this directory and install Voyager:


cd laravel-voyager
composer require tcg/voyager

Now let's update the .env file on the root of our project with the correct database parameters. I am connecting to a MySQL database.


DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

Add the two class reference to the Laravel configuration. The file is config/app.php;


...
'providers' => [
   ....
   TCG\Voyager\VoyagerServiceProvider::class,
   Intervention\Image\ImageServiceProvider::class,
]

....

Now install voyager applying all settings with the Laravel artisan command:


php artisan voyager:install
php artisan vendor:publish --tag=voyager_assets --force

Here comes a new problem. They say you must have an user on your database table but my user table was empty!
Let's create a new admin user with the same artisan command:


php artisan voyager:admin admin@admin.com --create

You can run the installation with some dummy data:

php artisan voyager:install --with-dummy

In this case, your username and password will be the same as below.

Raise your web server:


php artisan serve

Visit you admin login page:


http://localhost:8000/admin/login

Login with your username and password. I have created a user with these credential:


email: admin@admin.com
password: password

That's it! Now you have your correct Voyager admin panel installed. This tool is great but it doesn't have a good CRUD generator like the amazing Gii for Yii 2. You to install your own generator but I think Gii is better anyway because you can use different tools without adding any external dependency.

Resources

 

Share this post

This website and/or any sub domains use cookies to understand how you to improve your experience.