Table of Contents
This is part 2 of the series seo site manager in Laravel.
With lots of predefined fields and operations, including advanced operations, such as Reorder Operation (you can reorder and nesting entries) Backpack speeds up CRUD development time and allows adding complex features with just a few lines of code.
The documentation is quite thick, but I saw that they also have a series of BackPack video tutorials, which I hope will help me learn it quickly.
How to install BackpackForLaravel?
Open your project folder in your terminal
In your project’s main directory, install CRUD using composer:
composer require backpack/crud:"4.1.*" # you might also want to install these tools that help during development composer require backpack/generators --dev composer require laracasts/generators --dev
run the installation commands for Backpack
php artisan backpack:install
Important! By default, all users are considered admins.
If that’s not what you want in your application (you have both users and admins), please:
- Change app/Http/Middleware/CheckIfAdmin.php, particularly checkIfUserIsAdmin($user), to make sure you only allow admins to access the admin panel;
- Change app/Providers/RouteServiceProvider::HOME, which will send logged in (but not admin) users to /home, to something that works for your app;
Change configuration values in config/backpack/base.php to make the admin panel your own.
The backpack is a white-label, so you can change everything: menu color, project name, developer name, etc.
Read more here about how to install BackpackForLaravel
As soon as you install Backpack in your project, you can create CRUDs for your admins to easily manipulate DB information.
a simple example, of creating a CRUD administration panel for a Tag entity:
# STEP 1. create migration
php artisan make:migration:schema create_tags_table –schema=”name:string:unique”
php artisan migrate
# STEP 2. create crud
php artisan backpack:crud tag #use singular, not plural
This will create a simple CRUD panel, which you should now be able to see in the Sidebar.
Hello there!I hope you find this post useful!
I'm Mihai, a programmer and online marketing specialist, very passionate about everything that means online marketing, focused on eCommerce.
If you have a collaboration proposal or need helps with your projects feel free to contact me. I will always be glad to help you!