1

I am trying my hand at creating a sub domain route for a project I am working on and I am able to get the sub domain working. However, the only time it works is if I return some copy directly from the routes.php. When I try to access a controller, it tells me that it's not found, when it's clearly there.

This code:

Route::group(['domain' => 'demo.tk.dev'], function(){
Route::get('/', 'DemoController@demoLanding');
});

Returns me this error:

ReflectionException in Route.php line 280:
Class app\Http\Controllers\DemoController does not exist

But if I do something like this:

Route::group(['domain' => 'demo.tk.dev'], function(){
Route::get('/', function() {
    return 'Success';
});
});

Then that works.

I am not seeing anything in the documentation about making any other changes for the Controllers to work with the sub domain. Am I missing something? Any help would be greatly appreciated.

1 Answer 1

3

check if you have a DemoController in your Controller folder and check if it has correct namespace ie. namespace App\Http\Controllers;

Sign up to request clarification or add additional context in comments.

Comments

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.