How to Create Admin Panel using Voyager in Laravel 8

Share this Article
Reading Time: 5 minutes
8,511 Views

Inside this tutorial, we will create an admin panel in a very short time. Admin panel using Voyager composer package. This article is very interesting to learn admin panel development step by step.

Voyager provides the complete package of an admin panel in laravel. So inside this article we will create admin panel using voyager in laravel 8. Voyager for Laravel gives a modern and responsive PhpMyAdmin like admin panel with CRUD support and precise users’ access control for your Laravel API.

Very few simple steps we need to install and configure admin panel.

Let’s get started.


Installation of Laravel Application

Laravel Installation can be done in two ways.

  • Laravel Installer
  • By using composer

Laravel Installer

To install Laravel via Laravel installer, we need to install it’s installer first. We need to make use of composer for that.

$ composer global require laravel/installer

This command will install laravel installer at system. This installation is at global scope, so you type command from any directory at terminal. To verify type the given command –

$ laravel

This command will open a command palette of Laravel Installer.

To create ad install laravel project in system,

$ laravel new blog

With the name of blog a laravel project will be created at your specified path.

By using composer

Alternatively, we can also install Laravel by Composer command create-project.

If your system doesn’t has composer Installed, Learn Composer Installation Steps.

Here is the complete command to create a laravel project-

$ composer create-project --prefer-dist laravel/laravel blog

After following these steps we can install a Laravel application into system.

To start the development server of Laravel –

$ php artisan serve

This command outputs –

Starting Laravel development server: http://127.0.0.1:8000

Assuming laravel already installed at system.


Install Voyager for Laravel

By using composer we will install voyager. Open project into terminal and run this command.

$ composer require tcg/voyager

Create Database & Application Connectivity

We need to create a database. For database we will use MySQL. We have 2 options available to create database. Either we can use PhpMyAdmin Manual interface Or we can use command to create.

CREATE DATABASE voyager_admin_panel;

Open .env file for application connectivity.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=voyager_admin_panel
DB_USERNAME=admin
DB_PASSWORD=Admin@123

Run Voyager installer Laravel

There are two options to create the admin panel either with a dummy data or without.

To install Voyager without dummy data

$ php artisan voyager:install

To install Voyager with the dummy data

$ php artisan voyager:install --with-dummy

It is preferable to run the command using the dummy data and delete it after admin panel testing.

If we go inside database to see the tables and dummy data what we have installed. Total 17 tables created.


Application Testing

Open project to terminal and type the command to start development server

$ php artisan serve

By default Voyager provides Admin login details as –

Email: admin@admin.com
Password: password

Admin URL: http://127.0.0.1:8000/admin

Create a Different Admin User

Instead of using the default admin login details, if needs to create new one. Run this command –

Syntax

$ php artisan voyager:admin your@email.com --create

Example

$ php artisan voyager:admin onlinewebtutorhub@gmail.com --create

It will ask few questions like Admin name, password, confirm password.

Now, you can use your own login details to use Voyager Admin panel in Laravel 8.

Here, is the menus generated at admin panel of voyager.

About Generated Files

  1. /config/voyager-hooks.php
  2. /config/voyager.php
  3. Route added inside /routes/web.php
  4. Admin Panel Files – /vendor/tcg/voyager

We hope this article helped you to learn about How to Create Admin Panel using Voyager in Laravel 8 in a very detailed way.

If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.

Find More on Laravel 8 Articles here