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:
app/Http/Controllers/Admin
;app/Http/Requests
;routes/backpack/custom.php
;The only difference between building it from scratch and using Backpack\CRUD** is that:
Backpack\CRUD\app\Http\Controllers\CrudController
**, which already has the logic for a few operations: Create, Update, Delete, ListEntries, Show, Reorder, Revisions. 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 CrudController; 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/Http/Controllers/Admin/TagCrudController.php
);app/Http/Requests/TagCrudRequest.php
);routes/backpack/custom.php
;app/Models/Tag.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.