Route::auth() and namespacing
Ad
I have used make:auth
to create the login scaffold which works nicely in the base app. However I am creating a package so I have moved the files to their respective places in my package.
I have namespaced the route created by the make:auth
app to
Route::group(['middleware' => 'web'], function () {
Route::auth();
Route::get('/home', 'Package\Namespace\[email protected]');
});
When I comment out Route::auth();
everything seems to work fine. When I keep Route::auth
I get an error
Class Auth\AuthController does not exist
I cannot understand what the issue is. I don't know much about the auth()
helper function.
Ad
Answer
Ad
Obvious error...
Within Router.php
the auth()
function namespaces are in relation to the default Controllers
namespace.
Removing the auth()
function and adding all the namespaced routes into the routes file of course did the trick
// Authentication Routes...
Route::get('login', 'App\Http\Controllers\Auth\[email protected]');
Route::post('login', 'App\Http\Controllers\Auth\[email protected]');
Route::get('logout', 'App\Http\Controllers\Auth\[email protected]');
// Registration Routes...
Route::get('register', 'App\Http\Controllers\Auth\[email protected]');
Route::post('register', 'App\Http\Controllers\Auth\[email protected]');
// Password Reset Routes...
Route::get('password/reset/{token?}', 'App\Http\Controllers\Auth\[email protected]');
Route::post('password/email', 'App\Http\Controllers\Auth\[email protected]');
Route::post('password/reset', 'App\Http\Controllers\Auth\[email protected]');
Ad
source: stackoverflow.com
Related Questions
Ad
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS - Conditionally Load a Different Page
- → Make a Laravel collection into angular array (octobercms)
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
- → Validating fileupload(image Dimensions) in Backend Octobercms
- → OctoberCMS Fileupload completely destroys my backend
- → How do I call the value from another backed page form and use it on a component in OctoberCms
Ad