Create Admin Panel with Laravel Backpack Part 1
In today article “Create Admin Panel with Laravel Backpack Part 1” we will talk about how to create a quick and powerful admin panel. Most of the web application today need an admin panel specially when you need an api. You need admin panel for bulk manage the data of your application.
Here is the link for the other parts.
What’s laravel backpack?
According to the website Laravel Backpack is A software that helps Laravel professionals build administration panels – secure areas where administrators login and create, read, update and delete application information. It is not a CMS, it is more a framework that lets you build your own CMS. You can install it in your existing project or in a totally new project.
It’s designed to be flexible enough to allow you to build admin panels for everything from simple presentation websites to CRMs, ERPs, eCommerce, eLearning, etc. We can vouch for that, because we have built all that complex stuff using Backpack already.
To Follow this article you need some basics of laravel. If you are a beginner or need help for setup basic laravel installation you can follow our previous articles on this topic.
You need at least backpack 5.6 to install Laravel Backpack in this article we will use laravel 5.8. In order to install laravel you need composer installed as global command. You should already have it if you follow the previous article.
To install the backpack base run this command in your root project directory.
composer require backpack/crud
After the previous step you have the main files of laravel backpack, the core package and the crud. Now we gonna finish the installation of the base package. For that run this command.
php artisan backpack:base:install
The base package of backpack contain the basic structure of the admin panel like views, layouts.
Now we gonna install the crud functionality. This package allow us to quickly create crud for our table in the database. To install it run this command:
php artisan backpack:crud:install
As you can see in the screenshot below you will asked if you want to install the File Manager elfinder. If you choose yes you will have a file browser inside the admin where you will able to create, read, modify files and folder.
By default it lets users manage the
public/uploads directory, but you can change that in the
elfinder.php config file.
After that step start your laravel application with
php artisan serve then go to
http://localhost:8000/admin. If everything went well you should see your login screen.
If you don’t have an account click on register to create one then login with your new created account. After login you will see the dashboard that’s empty now. We will see how to start adding content in the next episode of this article.
Configure and customize backpack
The laravel backpack cms is very powerfull you can change almost everything to make it fit your needs. You can change the URL prefix from
admin to something else in your
config/backpack/base.php file, along with a bunch of other configuration options. The config file is the main place to change all the configureation.
Let’s start by changing the title of our admin panel. Go to the file
config/backpack/base.php and find this line .
// Project name. Shown in the breadcrumbs and a few other places. 'project_name' => 'Backpack', // Menu logos 'logo_lg' => '<b>Back</b>pack', 'logo_mini' => '<b>B</b>p',
Change it to fit your own needs and all the config code is well commented to know the utility of each configuration options. You can take a look at the config file here
Here is the end of our article “Create Admin Panel with Laravel Backpack Part 1” the part two will come out quickly. Please follow the block to be notified when the next article get published. In the next part we will talk about how to create a basic crud with a real world example admin panel. As usual if you got any trouble while executing the step. Drop a comment in the comment section below and i will try to help you.