前提・実現したいこと
引き続きlaravelにて本を見ながら学習しているのですが、
ログイン状態により遷移先を分ける処理の部分における、
未ログイン時の専用ページ遷移が上手くいきません。
初学者につき凡ミス等かもしれませんが、
お力を貸していただけると非常に助かります。
発生している問題・エラーメッセージ
・ログイン状態
該当のページ「http://localhost:8000/hello」に遷移する。
・未ログイン状態
なぜか「http://localhost:8000/login」に遷移してしまう。
・期待動作
未ログインの場合に「http://localhost:8000/hello/auth」に遷移させたい。
該当のソースコード
※web.phpのルーティングの一部
Route::get('hello', 'HelloController@index')
->middleware('auth');
Route::get('person','PersonController@index');
Route::post('hello','HelloController@post');
Route::get('hello/add', 'HelloController@add');
Route::post('hello/add', 'HelloController@create');
Route::get('hello/edit', 'HelloController@edit');
Route::post('hello/edit', 'HelloController@update');
Route::get('hello/del', 'HelloController@del');
Route::post('hello/del', 'HelloController@remove');
Route::get('hello/show', 'HelloController@show');
Route::get('hello/auth', 'HelloController@getAuth');
Route::post('hello/auth', 'HelloController@postAuth');
試したこと
http://localhost:8000/hello/authページ自体は
直接URL指定すれば遷移可能です。
よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/02/12 11:54