質問編集履歴
1
情報の追加のため
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,13 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
-
今発生している問題は下記のcon
|
9
|
+
今発生している問題は下記のconfirm.blade.phpからsend.blade.phpにpost送信してもpostで送信されないことです。
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
dd($request->('name'));などで確認してみましたが、nullでそのためvalidationのredirectでget methodを取っているのでこのエラーが発生していると仮定しました。
|
14
|
+
|
15
|
+
下記に試したことを載せてあります。
|
10
16
|
|
11
17
|
|
12
18
|
|
@@ -112,218 +118,126 @@
|
|
112
118
|
|
113
119
|
```ContactController
|
114
120
|
|
115
|
-
public function send(Cont
|
121
|
+
public function send(ContactRequest $request)
|
116
122
|
|
117
123
|
{
|
118
124
|
|
119
|
-
|
125
|
+
|
120
|
-
|
121
|
-
|
126
|
+
|
122
|
-
|
123
|
-
'content' => 'required|string',
|
124
|
-
|
125
|
-
'email' => 'required|string',
|
126
|
-
|
127
|
-
'name'=> 'required|string'
|
128
|
-
|
129
|
-
]);
|
130
|
-
|
131
|
-
*/
|
132
|
-
|
133
|
-
if($request->validated()){
|
127
|
+
if($request->validated()){
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
$to= 'kaai06221733@gmail.com';
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
Mail::to($to)->send(new Contactsendmail ([
|
136
|
+
|
137
|
+
'name'=>$request->name,
|
138
|
+
|
139
|
+
'from_email' => $request->email,
|
140
|
+
|
141
|
+
'data' => $request->content,
|
142
|
+
|
143
|
+
], 'mail.blade.php'));
|
144
|
+
|
145
|
+
|
134
146
|
|
135
147
|
|
136
148
|
|
137
|
-
\Mail::send(new ContactSendmail([
|
138
|
-
|
139
|
-
|
149
|
+
$request->session()->regenerateToken();
|
140
|
-
|
141
|
-
|
150
|
+
|
142
|
-
|
143
|
-
|
151
|
+
|
144
|
-
|
145
|
-
|
152
|
+
|
146
|
-
|
147
|
-
'data' => $request->content,
|
148
|
-
|
149
|
-
'subject' => '自動送信メール'
|
150
|
-
|
151
|
-
|
153
|
+
return view('contact.send');
|
154
|
+
|
152
|
-
|
155
|
+
}
|
153
|
-
|
156
|
+
|
157
|
+
|
154
158
|
|
155
159
|
|
156
160
|
|
157
|
-
$request->session()->regenerateToken();
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
return view('contact.send');
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
161
|
+
}
|
162
|
+
|
163
|
+
```
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
```Contactsendmail
|
168
|
+
|
169
|
+
<?php
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
namespace App\Mail;
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
use Illuminate\Bus\Queueable;
|
178
|
+
|
179
|
+
use Illuminate\Contracts\Queue\ShouldQueue;
|
180
|
+
|
181
|
+
use Illuminate\Mail\Mailable;
|
182
|
+
|
183
|
+
use Illuminate\Queue\SerializesModels;
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
class Contactsendmail extends Mailable
|
188
|
+
|
189
|
+
{
|
190
|
+
|
191
|
+
use Queueable, SerializesModels;
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
protected $data;
|
198
|
+
|
199
|
+
protected $view;
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
public function __construct($data , $view = 'mail.blade.php')
|
210
|
+
|
211
|
+
{
|
212
|
+
|
213
|
+
$this->data = $data;
|
214
|
+
|
215
|
+
$this->view =$view;
|
166
216
|
|
167
217
|
|
168
218
|
|
169
|
-
|
170
|
-
|
171
219
|
}
|
172
220
|
|
173
|
-
|
221
|
+
|
174
|
-
|
175
|
-
|
176
|
-
|
222
|
+
|
223
|
+
|
224
|
+
|
177
|
-
|
225
|
+
public function build()
|
178
|
-
|
179
|
-
<?php
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
namespace App\Mail;
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
use Illuminate\Bus\Queueable;
|
188
|
-
|
189
|
-
use Illuminate\Contracts\Queue\ShouldQueue;
|
190
|
-
|
191
|
-
use Illuminate\Mail\Mailable;
|
192
|
-
|
193
|
-
use Illuminate\Queue\SerializesModels;
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
class Contactsendmail extends Mailable
|
198
|
-
|
199
|
-
{
|
200
|
-
|
201
|
-
use Queueable, SerializesModels;
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
protected $data;
|
208
|
-
|
209
|
-
protected $view;
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
public function __construct($data , $view = 'mail.blade.php')
|
220
226
|
|
221
227
|
{
|
222
228
|
|
229
|
+
return $this->from($this->data['from_email'], $this->data['name'])
|
230
|
+
|
231
|
+
->to($this->data['to'] , $this->data['to_name'])
|
232
|
+
|
223
|
-
$this->data
|
233
|
+
->subject($this->data['subject'])
|
224
|
-
|
234
|
+
|
225
|
-
|
235
|
+
->view('contact.mail' . $this->view)
|
236
|
+
|
226
|
-
|
237
|
+
->with(['data'=> $this->data]);
|
227
|
-
|
228
238
|
|
229
239
|
}
|
230
240
|
|
231
|
-
|
232
|
-
|
233
|
-
/**
|
234
|
-
|
235
|
-
* Build the message.
|
236
|
-
|
237
|
-
*
|
238
|
-
|
239
|
-
* @return $this
|
240
|
-
|
241
|
-
*/
|
242
|
-
|
243
|
-
public function build()
|
244
|
-
|
245
|
-
{
|
246
|
-
|
247
|
-
return $this->from($this->data['from_email'], $this->data['name'])
|
248
|
-
|
249
|
-
->to($this->data['to'] , $this->data['to_name'])
|
250
|
-
|
251
|
-
->subject($this->data['subject'])
|
252
|
-
|
253
|
-
->view('contact.mail' . $this->view)
|
254
|
-
|
255
|
-
->with(['data'=> $this->data]);
|
256
|
-
|
257
|
-
}
|
258
|
-
|
259
|
-
}
|
260
|
-
|
261
|
-
```
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
```ContentRequest
|
266
|
-
|
267
|
-
public function authorize()
|
268
|
-
|
269
|
-
{
|
270
|
-
|
271
|
-
return true;
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
}
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
/**
|
280
|
-
|
281
|
-
*
|
282
|
-
|
283
|
-
* Get the validation rules that apply to the request.
|
284
|
-
|
285
|
-
*
|
286
|
-
|
287
|
-
* @return array
|
288
|
-
|
289
|
-
*/
|
290
|
-
|
291
|
-
public function rules()
|
292
|
-
|
293
|
-
{
|
294
|
-
|
295
|
-
return [
|
296
|
-
|
297
|
-
'user_id'=>'required',
|
298
|
-
|
299
|
-
'title' => 'required|string|max:255',
|
300
|
-
|
301
|
-
'name' => 'required|string',
|
302
|
-
|
303
|
-
'email' => 'required|string',
|
304
|
-
|
305
|
-
'continent' => 'required|string',
|
306
|
-
|
307
|
-
'picture'=> 'mimes:jpeg,jpg,png,gif|required|max:1000',
|
308
|
-
|
309
|
-
'country' => 'required|string',
|
310
|
-
|
311
|
-
'costs'=>'required|numeric',
|
312
|
-
|
313
|
-
'span'=>'required|numeric',
|
314
|
-
|
315
|
-
'content'=>'required|string|max:250',
|
316
|
-
|
317
|
-
];
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
}
|
326
|
-
|
327
241
|
```
|
328
242
|
|
329
243
|
|
@@ -338,11 +252,11 @@
|
|
338
252
|
|
339
253
|
・enctype="multipart/form-data"の挿入
|
340
254
|
|
341
|
-
・sendメソッドでCont
|
255
|
+
・sendメソッドでContactRequestを使用する
|
342
256
|
|
343
257
|
・routeのキャッシュをクリアにする
|
344
258
|
|
345
|
-
・自作のRequest(Cont
|
259
|
+
・自作のRequest(ContactRequest)のauthorizeをtrueにする
|
346
260
|
|
347
261
|
|
348
262
|
|