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.
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.
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
email@example.com / password to login.
Congrats you did it! Check out Voyager’s amazing features by reading the docs or checking out the video tutorials below.
Originally published on Codementor.io