-1

I want to create custom controller in Voyager admin package, but I got this error message :

Class 'App\Http\Controllers\Back\VoyagerBreadController' not found

  1. I added the new controller name to the bread.

enter image description here

  1. I created a namespace a folder /Back in App/Http/Controllers
  2. I created a file BookingController.php
  3. My BookingController:
namespace App\Http\Controllers\Back;

use Illuminate\Http\Request;

class BookingController extends VoyagerBreadController
{
    .......
}

I also tried to edit this line of voyager.php to the new controller namespace but I got the same error.

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

I have checked and VoyagerBreadController does exist!

matiaslauriti
  • 7,065
  • 4
  • 31
  • 43
dev198742
  • 11
  • 3

1 Answers1

0

The problem is pretty clear, if you read carefully... You are extending VoyagerBreadController in your BookingController class but you are not telling where does VoyagerBreadController come from, because you have created a new folder Back, I assume you have only created the controller BookingController in that folder, so it cannot find VoyagerBreadController in the same folder...

matiaslauriti
  • 7,065
  • 4
  • 31
  • 43
  • Thanks, for the reply. I copied VoyagerBreadController into the Back folder and I got same error. – dev198742 May 19 '21 at 08:01
  • Does the `VoyagerBreadController` have the correct namespace ? It should be `namespace App\Http\Controllers\Back;`. Can you share the file with us ? Also try running `composer dump-autoload` when you copy the file, but that should work. – matiaslauriti May 19 '21 at 17:34