質問編集履歴
1
.envファイルなど追記
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Laravelで
|
1
|
+
Laravelローカル環境で404が出る
|
test
CHANGED
@@ -14,13 +14,61 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
+
##追記
|
18
|
+
|
19
|
+
やはりルーティングはあってるような気がします。
|
20
|
+
|
21
|
+
下記ソースでhttp://localhostにアクセスしても404になってます。
|
22
|
+
|
23
|
+
|
24
|
+
|
17
25
|
|
18
26
|
|
19
27
|
|
20
28
|
|
21
29
|
##ソース
|
22
30
|
|
31
|
+
```
|
32
|
+
|
33
|
+
#web.php
|
34
|
+
|
35
|
+
<?php
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
declare(strict_types=1);
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
use App\Http\Controllers;
|
44
|
+
|
45
|
+
use Illuminate\Routing\Router;
|
46
|
+
|
47
|
+
use Illuminate\Support\Facades\Route;
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
/*
|
52
|
+
|
53
|
+
|--------------------------------------------------------------------------
|
54
|
+
|
23
|
-
|
55
|
+
| Web Routes
|
56
|
+
|
57
|
+
|--------------------------------------------------------------------------
|
58
|
+
|
59
|
+
|
|
60
|
+
|
61
|
+
| Here is where you can register web routes for your application. These
|
62
|
+
|
63
|
+
| routes are loaded by the RouteServiceProvider within a group which
|
64
|
+
|
65
|
+
| contains the "web" middleware group. Now create something great!
|
66
|
+
|
67
|
+
|
|
68
|
+
|
69
|
+
*/
|
70
|
+
|
71
|
+
|
24
72
|
|
25
73
|
Route::prefix('drinks')->name('drink.')->group(
|
26
74
|
|
@@ -28,15 +76,21 @@
|
|
28
76
|
|
29
77
|
$router->get('/', [Controllers\DrinkController::class, 'index'])->name('index');
|
30
78
|
|
79
|
+
$router->post('/buy/{id}', [Controllers\DrinkController::class, 'buy'])->name('buy');
|
80
|
+
|
31
81
|
}
|
32
82
|
|
33
83
|
);
|
84
|
+
|
85
|
+
|
34
86
|
|
35
87
|
```
|
36
88
|
|
37
89
|
|
38
90
|
|
91
|
+
```
|
92
|
+
|
39
|
-
|
93
|
+
#Controllers\DrinkController
|
40
94
|
|
41
95
|
<?php
|
42
96
|
|
@@ -106,8 +160,16 @@
|
|
106
160
|
|
107
161
|
}
|
108
162
|
|
109
|
-
|
163
|
+
```
|
110
164
|
|
111
165
|
|
112
166
|
|
113
167
|
```
|
168
|
+
|
169
|
+
#.env
|
170
|
+
|
171
|
+
APP_URL=http://localhost
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
```
|