質問編集履歴
2
web.phpの記載
title
CHANGED
File without changes
|
body
CHANGED
@@ -9,6 +9,91 @@
|
|
9
9
|
|
10
10
|
ご回答よろしくお願いいたします。
|
11
11
|
|
12
|
+
```web.php
|
13
|
+
<?php
|
14
|
+
|
15
|
+
use App\Laboratory;
|
16
|
+
use Illuminate\Http\Request;
|
17
|
+
|
18
|
+
Auth::routes(); //認証機能を使用する。
|
19
|
+
|
20
|
+
Route::get('register/verify/{token}', 'Auth\RegisterController@showForm');
|
21
|
+
|
22
|
+
Route::post('register/main_check', 'Auth\RegisterController@mainCheck')->name('register.main.check');
|
23
|
+
Route::post('register/main_register', 'Auth\RegisterController@mainRegister')->name('register.main.registered');
|
24
|
+
|
25
|
+
Route::get('/home', 'LabController@index')->name('home');
|
26
|
+
|
27
|
+
Route::get('/review/{token}', 'LinkController@qr_to_add');
|
28
|
+
|
29
|
+
Route::group(['middleware' => ['web']], function ()
|
30
|
+
{
|
31
|
+
|
32
|
+
Route::post('register/pre_check', 'Auth\RegisterController@pre_check')->name('register.pre_check');
|
33
|
+
|
34
|
+
Route::get('/', 'LabController@index');
|
35
|
+
Route::post('/', 'LabController@index');
|
36
|
+
|
37
|
+
Route::get('/search_result', 'LabController@search');
|
38
|
+
|
39
|
+
Route::get('/area/{pre_name}','LabController@area_search');
|
40
|
+
|
41
|
+
Route::get('/faculty_result/{faculty}', 'LabController@faculty_result');
|
42
|
+
|
43
|
+
Route::post('/laboratories', 'LabController@store');
|
44
|
+
|
45
|
+
Route::post('/add/2', 'LabController@ret_univ');
|
46
|
+
|
47
|
+
Route::post('/laboratory/{laboratory}', 'LabController@store_evaluation');
|
48
|
+
|
49
|
+
Route::post('/', 'LabController@mv_add');
|
50
|
+
|
51
|
+
Route::post('/labedit/{lab_evaluation_id}','LabController@mv_update');
|
52
|
+
|
53
|
+
Route::post('/mypage/update', 'LabController@update');
|
54
|
+
|
55
|
+
Route::delete('/mypage/delete/{lab_evaluation_id}', 'LabController@delete');
|
56
|
+
|
57
|
+
Route::PUT('update',[
|
58
|
+
'uses' => 'UserController@update',
|
59
|
+
'as' => 'update'
|
60
|
+
]);
|
61
|
+
|
62
|
+
|
63
|
+
Route::get('/add', 'LinkController@to_add');
|
64
|
+
|
65
|
+
Route::POST('/add_evaluation', 'LabController@add_evaluation');
|
66
|
+
|
67
|
+
Route::GET('/add_evaluation', function()
|
68
|
+
{
|
69
|
+
return view('add_evaluation');
|
70
|
+
});
|
71
|
+
|
72
|
+
Route::get('/add_evaluation/{lab_details_univ}/{lab_details_lab}', 'LinkController@to_add_evaluation');
|
73
|
+
|
74
|
+
Route::get('/univ/{univ_name}','LinkController@to_univ');
|
75
|
+
|
76
|
+
Route::get('/lab/{lab_details_univ}/{lab_details_lab}','LinkController@to_lab_details');
|
77
|
+
|
78
|
+
Route::get('/lab-evaluation/{lab_evaluation_details}','LinkController@to_lab_evaluation_details');
|
79
|
+
|
80
|
+
Route::get('/mypage','LinkController@to_mypage');
|
81
|
+
|
82
|
+
|
83
|
+
Route::get('/confirm_user',[
|
84
|
+
'uses' => 'UserController@confirm_user',
|
85
|
+
'as' => 'confirm'
|
86
|
+
]);
|
87
|
+
|
88
|
+
Route::get('/edit_user','UserController@edit_user');
|
89
|
+
|
90
|
+
|
91
|
+
Route::get('/scraping','ScrapingController@scraping');
|
92
|
+
|
93
|
+
});
|
94
|
+
```
|
95
|
+
|
96
|
+
|
12
97
|
---
|
13
98
|
|
14
99
|
調べたところ、[こちらのサイトで](https://qiita.com/zaburo/items/9fcf0f4c771e011a4d35)
|
1
解決策の候補の提示とその補足のお願い
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,4 +7,52 @@
|
|
7
7
|
|
8
8
|
そういった実装方法はございますでしょうか。
|
9
9
|
|
10
|
-
ご回答よろしくお願いいたします。
|
10
|
+
ご回答よろしくお願いいたします。
|
11
|
+
|
12
|
+
---
|
13
|
+
|
14
|
+
調べたところ、[こちらのサイトで](https://qiita.com/zaburo/items/9fcf0f4c771e011a4d35)
|
15
|
+
```Authenticate.php
|
16
|
+
<?php
|
17
|
+
|
18
|
+
namespace App\Http\Middleware;
|
19
|
+
|
20
|
+
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
21
|
+
|
22
|
+
class Authenticate extends Middleware
|
23
|
+
{
|
24
|
+
/**
|
25
|
+
* Get the path the user should be redirected to when they are not authenticated.
|
26
|
+
*
|
27
|
+
* @param \Illuminate\Http\Request $request
|
28
|
+
* @return string|null
|
29
|
+
*/
|
30
|
+
protected function redirectTo($request)
|
31
|
+
{
|
32
|
+
if (! $request->expectsJson()) {
|
33
|
+
return route('login');
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
```
|
39
|
+
|
40
|
+
ここで、認証のないアカウントのリダイレクト処理が行われていると書いていました。
|
41
|
+
|
42
|
+
Auth::route()からいろいろ経由してここに飛んでくるみたいなのですが、ここでの引数($request)とは一体なにを指すのでしょうか?
|
43
|
+
|
44
|
+
もし、Authenticate.phpで
|
45
|
+
```条件分岐
|
46
|
+
protected function redirectTo($request)
|
47
|
+
{
|
48
|
+
if(ある特定のパスにアクセスがあったとき){
|
49
|
+
ある特定のページにリダイレクトする。
|
50
|
+
}
|
51
|
+
//それ以外は
|
52
|
+
elseif (! $request->expectsJson()) {
|
53
|
+
return route('login');
|
54
|
+
}
|
55
|
+
}
|
56
|
+
```
|
57
|
+
|
58
|
+
このような形で、ある特定ページにのみ認証なしでアクセスすることは可能でしょうか。
|