2

This is driving me insane but maybe (or probably) I am just missing something.

I'm trying to install GrafiteCMS and have followed the docs (Complex Setup). Admin area etc. works fine but I can't get the controllers (generated through vendor:publish) in the folder Controllers/Cms to work. I am getting the error:

Class Cms\PagesController does not exist

The controller has the following namespace and is named PagesController:

namespace App\Http\Controllers\Cms;

The autoload classmap looks correct, too:

'App\\Http\\Controllers\\Cms\\PagesController' => $baseDir . '/app/Http/Controllers/Cms/PagesController.php',

So what am I missing? It relates to all controllers inside the Cms directory.

3
  • What is result php artisan route:list Commented Jul 7, 2018 at 22:15
  • @Davit it doesn't work because of the same error. Commented Jul 7, 2018 at 22:20
  • See my new answer Commented Jul 7, 2018 at 22:29

2 Answers 2

1

I solved it. They should update the code. For anyone with the same issue:

They are publishing the cms-routes file with just the namespace Cms which is wrong. It has to be the full namespace App\Http\Controllers\Cms. So edit your cms-routes to look like this:

Route::group(['namespace' => 'App\Http\Controllers\Cms', 'middleware' => ['cms-language', 'cms-analytics']], function () {
    Route::get('', 'PagesController@home');
    Route::get('pages', 'PagesController@all');
    Route::get('page/{url}', 'PagesController@show');
    Route::get('p/{url}', 'PagesController@show');

    Route::get('gallery', 'GalleryController@all');
    Route::get('gallery/{tag}', 'GalleryController@show');

    Route::get('blog', 'BlogController@all');
    Route::get('blog/{url}', 'BlogController@show');
    Route::get('blog/tags/{tag}', 'BlogController@tag');

    Route::get('faqs', 'FaqController@all');

    Route::get('events', 'EventsController@calendar');
    Route::get('events/{month}', 'EventsController@calendar');
    Route::get('events/all', 'EventsController@all');
    Route::get('events/date/{date}', 'EventsController@date');
    Route::get('events/event/{id}', 'EventsController@show');
});
Sign up to request clarification or add additional context in comments.

Comments

0

RouteServiceProvider code must be this .

protected function mapWebRoutes()
{
    Route::middleware('web')
         ->namespace($this->namespace)
         ->group(function() { 
        require base_path('routes/web.php');
        require base_path('routes/cms.php');  // if it is not exists error occurs 
    });
}

Check it

12 Comments

See my answer. But I tried your solution anyways but it doesn't work. I think your solution is for the other setup type. Don't know, strange package tbh. But thank you anyways!
I try only this 3 steps
1)composer require grafite/cms 2)php artisan vendor:publish --provider="Grafite\Cms\GrafiteCmsProvider" and 3)php artisan grafite:cms
In 3-rd step will message Please confirm that you have a database set and configured in your .env file. ( yes/no) [no]: > y after it I pass y and all work perfect
You did the simple setup but my issue related to the complex setup. You can try it, too if you have the time but I think it won't work, too.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.