I have this route :
Route::get('/', function () {
return view('pages/home');
});
Auth::routes();
Route::get('/pages/home', 'HomeController@index');
Route::get('register', function() {
return redirect('/');
});
Route::get('logout', '\App\Http\Controllers\Auth\LoginController@logout');
Route::group(['middleware' => ['web']], function () {
Route::get('user', 'UserController@index');
Route::get('admin', 'AdminController@index');
Route::get('user/create', 'UserController@create');
Route::get('user/{user}', 'UserController@show')->name('user');
Route::post('user', 'UserController@store');
Route::get('user/{user}/edit', 'UserController@edit');
Route::patch('user/{user}', 'UserController@update');
Route::delete('user/{user}', 'UserController@destroy');
});
Route::group(['middleware' => ['web']], function () {
Route::get('profile', 'ProfileController@index')->name('profile');
Route::get('profile/{profile}/edit', 'ProfileController@edit');
Route::patch('profile/{profile}', 'ProfileController@update');
});
Route::group(['middleware' => ['web']], function () {
Route::get('edition', 'EditionController@index');
Route::get('edition/create', 'EditionController@create');
Route::get('edition/{edition}', 'EditionController@show')->name('edition');
Route::post('edition', 'EditionController@store');
Route::get('edition/{edition}/edit', 'EditionController@edit');
Route::patch('edition/{edition}', 'EditionController@update');
Route::delete('edition/{edition}', 'EditionController@destroy');
});
Route::group(['middleware' => ['web']], function () {
Route::get('journal', 'JournalController@index');
Route::get('journal/create', 'JournalController@create');
Route::get('journal/{journal}', 'JournalController@show');
Route::post('journal', 'JournalController@storejournal');
Route::get('journal/{journal}/edit', 'JournalController@edit');
Route::patch('journal/{journal}', 'JournalController@update');
Route::delete('journal/{journal}', 'JournalController@destroy');
});
When a user is logged in and go straight to profile page Route::get('profile', 'ProfileController@index')->name('profile'); it shows error message NotFoundHttpException in RouteCollection.php line 161: but when the user is go to another page first like home page and then go to profile page it's working without errors. How do I solve this ? is the problem is in the route or another files ? I'm a newbie in coding, please help, thank you.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire