简体   繁体   English

Laravel Voyager向BREAD控制器添加其他方法

[英]Laravel Voyager add additional methods to a BREAD controller

I created a new database through Voyager admin and created BREAD for that table. 我通过Voyager管理员创建了一个新数据库,并为该表创建了BREAD。 Now I need to add additional methods to that controller. 现在,我需要向该控制器添加其他方法。

I tried to create a custom controller by following this . 我试图通过遵循此步骤来创建自定义控制器。 But the default actions (CRUD) of the controllers are gone. 但是控制器的默认操作(CRUD)消失了。

Without disturbing the existing functionalities of the BREAD I need to add a few more methods in that controller. 在不影响BREAD现有功能的情况下,我需要在该控制器中添加更多方法。 Is this possible? 这可能吗?

I believe you missed to extend voyager's default BREAD controller . 我相信您错过了扩展voyager的默认BREAD控制器的机会 for example let say we want to extend a Controller for our Product Model. 例如,假设我们要扩展产品模型的控制器。 so we make a ProductController like : 所以我们制作一个ProductController像这样:

<?php
namespace App\Http\Controllers;

class ProductController extends TCG\Voyager\Http\Controllers\VoyagerBaseController{

    //add more functions
}

good luck 祝好运

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM