How to use Backpack for Laravel on existing project?

空扰寡人 提交于 2020-07-21 06:35:28

问题


I'm building a small app with Laravel and I juste 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 be mutch appreciated !

Thank you all and have a nice day!

Cheers from France


回答1:


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



来源:https://stackoverflow.com/questions/62116088/how-to-use-backpack-for-laravel-on-existing-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!