In this article we will discuss the how to create admin panel in Laravel. So, creating an admin panel in Laravel we have use the Laravel package “Voyager- The Missing Laravel Admin”.
So, the first question arises is why we using the “Laravel Voyager” package. Basically “Voyager” is a powerful package to handle the complex operations such as handling the CRUD (create, read, update and delete) operations and also the optimization of the server side and client side code.
Voyager has the BREAD system, which allows you to browse, read, edit, add and delete any content on your site. Voyager is simply an admin for your application, you have full control over how your Laravel application will function on the front-end and then you can pass off the entire administrative task to Voyager.
Features provided by Voyager package:
- Module Management
- Roles and Permissions Management
- Media Manager
- Menu Builder
- BREAD Builder
- The Database Manager
- Multi Language Support
Note: To know more about “Voyager” visits this link: https://voyager.devdojo.com/.
Installation or Creating Admin Panel
1.First you have to create a “Laravel” project inside your project directory. Run this command using the composer: “composer create-project –prefer-dist laravel/laravel projectname”.
2. Once the project installs, you can include the “Voyager package” with command: “composer require tcg/voyager”. Run this command in your terminal inside your Laravel project directory.
3. After running the voyager command, create a new database.
4. After creating a new database, then go to your project and modify database driver in the “.env” file and also modify the “APP_URL”.
5. Next, open your project, go to directory “config/app.php” file and add the Voyager Service provider in the provider array.
6. Finally, you can install Voyager. There are two options to create admin panel with a dummy data or without dummy data. Commands are:
With dummy data: “php artisan voyager:install –with-dummy”.
The dummy data will include 1admin account (if no users exist), 1 demo page, 4 demo posts, 2 categories and 7 settings. This will contain the default login credentials:
Without dummy data: “php artisan voyager:install”.
In this article, I have installed the Voyager using dummy data.
7. After successful installation navigate to “http://localhost/admin/”.
After browse the address, you will be asked to enter the user name and password.
After Login, the dashboard homepage will look like this:
Add New user in Users panel
adding users, it will look like
Note: In this panel, you can customize the dashboard as you wish to want and you can add more features. The directory of this panel is located at: “vendor/tcg/voyager”.