phplaravellaravel-backpack

How to add simple view other than Crud to Laravel Backpack


I'm trying to figure out how to add a simple view (without CRUD) to Laravel Backpack. I've found this article, however I can't make it work.

I have added new controller and view, however I'm getting following error:

Method App\Http\Controllers\Admin\RaportyController::setupRoutes does not exist.

I don't understand the routes, what should I add to make it work?

Thank you

EDIT

I've changed the ::crud to ::get in my routes and I'm getting a different error: App\Http\Controllers\Admin\RaportyParkingoweController is not invokable.

My routes (custom.php) file:

    <?php

// --------------------------
// Custom Backpack Routes
// --------------------------
// This route file is loaded automatically by Backpack\Base.
// Routes you generate using Backpack\Generators will be placed here.

Route::group([
    'prefix'     => config('backpack.base.route_prefix', 'admin'),
    'middleware' => array_merge(
        (array) config('backpack.base.web_middleware', 'web'),
        (array) config('backpack.base.middleware_key', 'admin')
    ),
    'namespace'  => 'App\Http\Controllers\Admin',
], function () { // custom admin routes
    Route::crud('opinie', 'OpinieCrudController');
    Route::crud('rezerwacje', 'RezerwacjeCrudController');
    Route::crud('uzytkownicy', 'UzytkownicyCrudController');
    Route::get('raporty', 'RaportyController');
}); // this should be the absolute last line of this file

Solution

  • It should be a simple fix, point to the method you want in that controller: when you're using Route::get(), make sure to also specify the method you want to point to. It should be Route::get('RaportyParkingoweController@yourMethodName');, not Route::get('RaportyParkingoweController');.