Build a fullstack admin app with Voyager in 5 minutes

Published Jul 12, 2017
Build a fullstack admin app with Voyager in 5 minutes

Laravel is an incredible framework built by Taylor Otwell that combines powerful web development features, extensive documentation and an active community. In this tutorial we are going to build a fullstack application complete with an admin panel and user management.Special thanks to The Control Group for building Voyager, an open source admin tool for Laravel.

Minute 1: Create the Laravel application

I'm going to assume you have Laravel and MySQL installed for the purposes of this tutorial. I wrote a short shell script for creating Laravel applications available here if you are not familiar with the commands or interested in saving yourself time.

Minute 2: Generate a Database

Create a MySQL database and set your environment variables. You will need to know the MySQL username and password for your dev machine. The commands below should help:

$ mysql -uroot -p 
MySQL [(none)]> create database NAME_OF_YOUR_APP;

I also recommend Sequel Pro for visualizing records and tables within the database we created.

Sequel Pro database connection interface

Minute 3: Set your environment variables

The first shell script to create the Laravel application created a .env file. Open up the project in Sublime Text or your editor of choice and edit the .env files so that our Laravel application can connect to the database we set up.

APP_URL=localhost:8000
DB_HOST=localhost
DB_DATABASE=THE_NAME_OF_DATABASE_YOU_CREATED
DB_USERNAME=THE_MYSQL_DATABASE_USERERNAME_ON_YOUR_MACHINE
DB_PASSWORD=THE_MYSQL_DATABASE_PASSWORD_ON_YOUR_MACHINE

We need to clear out the configuration cache so that Laravel can update the application with the new values. Additionally, we need to run our database migrations to create the tables and columns for MySQL. Migrations in Laravel applications are in database/migrations.

php artisan config:clear
php artisan migrate

Minute 4: Install and Configure Voyager

Use Composer to install Voyager: composer require tcg/voyager

Add the Voyager pachage to our list of supported Package Service Providers. This list is in config/app.php.

'providers' => [
    // Laravel Framework Service Providers...
    //...

    // Package Service Providers
    TCG\Voyager\VoyagerServiceProvider::class,
    // ...

    // Application Service Providers
    // ...
],

You'll now have access to a voyager artisan command that will generate all of the required files for a state of the art admin dashboard. Run that command.

$ php artisan voyager:install --with-dummy

Minute 5: Log into your Admin dashboard to check it out!

Start your application with php artisan serve and then head to http://localhost:8000/admin. Use the default credentials admin@admin.com / password to login.

Congrats you set up the admin dashboard for a brand new Laravel app!

Congrats you did it! Check out Voyager's amazing features by reading the docs or checking out the video tutorials below.

Voyager Laravel intro video

Thanks for reading! If you enjoyed the article give me a shout on twitter or you can support the Voyager project directly by issuing a PR or giving it a star on github.

Discover and read more posts from Connor Leech
get started
Enjoy this post?

Leave a like and comment for Connor

4
1