Backpack\CRUD provides a fast way to build administration panels - places where your administrators can Create, Read, Update, Delete entries for a specific Eloquent model. One CRUD Panel provides functionality for one Eloquent Model.
In order to create a CRUD Panel, you'll need:
If you don't already have the models, don't worry, Backpack also includes a faster way to generate database migrations and models.
A Backpack CRUD Panel uses the same elements you would have created for an administration panel, if you were doing it from scratch:
routes/backpack/custom.php; points to a controller;app/Http/Controllers/Admin; holds the logic for the all operations an admin can perform on that Eloquent model;app/Http/Requests; used to validate Create/Update forms;The only differences between building it from scratch and using Backpack\CRUD are that:
Backpack\CRUD\app\Http\Controllers\CrudController, which allows you to easily add traits to handle the already-built operations: Create, Update, Delete, List, Show, Reorder, Revisions etc.use \Backpack\CRUD\CrudTrait;This simple architecture (ProductCrudController extends CrudController) means:
For example:
Product is shown to the admin? just create a method called show() in your ProductCrudController; simple OOP dictates that your method will be picked up, instead of the one in the ShowOperation trait; some goes for create(), store(), etc - you have complete control;Product? your ProductCrudController is a great place for that logic; just create a custom publish() method and a route that points to it;For a Tag entity, your CRUD Panel would consist of:
app/Models/Tag.php);routes/backpack/custom.php;app/Http/Controllers/Admin/TagCrudController.php);app/Http/Requests/TagCrudRequest.php);To further your understanding of how a CRUD Panel works, read more about this example in the tutorial.
Then you'll love our premium add-ons - productivity tools and tons of new features.