Laravel

Create a custom controller in Voyager

Oct 29, 2019

So you need to create a custom controller in Voyager so you can use it when creating a BREAD/CRUD ? Ok.

In config\voyager.php add your namespace:

'controllers' => [
    'namespace' => 'App\Http\Controllers\Voyager',
],

Then publish voyager controllers to your namespace

php artisan voyager:controllers

Within that namespace, create a new controller derived from VoyagerBaseController

namespace App\Http\Controllers\Voyager;

use Illuminate\Http\Request;

class ExampleController extends VoyagerBaseController
{
...

Then you can specify the Controller in the BREAD editor in Voyager. 
I did have to refer to mine as App\Http\Controllers\Voyager\ExampleController instead of just ExampleController

Laravel   Voyager   Controllers