Reputation: 9828
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\HomeController@index');
});
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.
Upvotes: 2
Views: 6219
Reputation: 9828
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\AuthController@showLoginForm');
Route::post('login', 'App\Http\Controllers\Auth\AuthController@login');
Route::get('logout', 'App\Http\Controllers\Auth\AuthController@logout');
// Registration Routes...
Route::get('register', 'App\Http\Controllers\Auth\AuthController@showRegistrationForm');
Route::post('register', 'App\Http\Controllers\Auth\AuthController@register');
// Password Reset Routes...
Route::get('password/reset/{token?}', 'App\Http\Controllers\Auth\PasswordController@showResetForm');
Route::post('password/email', 'App\Http\Controllers\Auth\PasswordController@sendResetLinkEmail');
Route::post('password/reset', 'App\Http\Controllers\Auth\PasswordController@reset');
Upvotes: 8