How to use Backpack for Laravel on existing project?

Viewed 448

I'm building a small app with Laravel and I just discovered Backpack that looks very nice !

I downloaded it (I have a license), but I really don't know how to use it with my existing files (so far 3 controllers, 3 models and a few blade files)

Maybe the answer is somewhere in the documentation, but I could not find it..

A detailed explanation would help.

1 Answers

suppose you have model called Person ...

php artisan backpack:crud Person

the generated command will tell you that the model is existed... and it will generate the routes and Crud Controller for you ...

then you go to your model ... in 'use' section add:

use Backpack\CRUD\app\Models\Traits\CrudTrait;

and in your model body ... add

 use CrudTrait;

you can also override the views ... witch i do not recommend unless you have good reason for that

https://backpackforlaravel.com/docs/4.1/upgrade-guide#views

Related