質問するログイン新規登録

質問編集履歴

1

全文の入力

2021/03/15 01:55

投稿

kenkbou
kenkbou

スコア151

title CHANGED
File without changes
body CHANGED
@@ -6,9 +6,51 @@
6
6
 
7
7
  Mail/MailRequest.php
8
8
  ```PHP
9
+ <?php
10
+
11
+ namespace App\Mail;
12
+
13
+ use App\Services\LineService;
14
+ use App\User;
15
+ use Illuminate\Bus\Queueable;
16
+ use Illuminate\Contracts\Queue\ShouldQueue;
17
+ use Illuminate\Mail\Mailable;
18
+ use Illuminate\Queue\SerializesModels;
19
+
20
+ class Request extends Mailable
21
+ {
22
+ use Queueable, SerializesModels;
23
+
24
+ /**
25
+ * @var User
26
+ */
27
+ private $user;
28
+ /**
29
+ * @var LineService
30
+ */
31
+ private $line;
32
+
33
+ /**
34
+ * Create a new message instance.
35
+ *
36
+ * @param User $user
37
+ */
38
+ public function __construct(User $user)
39
+ {
40
+ $this->user = $user;
41
+ $this->line = new LineService();
42
+ }
43
+
44
+ /**
45
+ * Build the message.
46
+ *
47
+ * @return $this
48
+ */
49
+ public function build()
50
+ {
9
51
  $title = 'XXX';
10
52
  $text = file_get_contents(resource_path('views/emails/request.blade.php'));
11
- $url = route('request.index');
53
+ $url = route('reservation.index');
12
54
 
13
55
  $this->line->sendMessage(
14
56
  $this->user->line_token,
@@ -16,11 +58,13 @@
16
58
  );
17
59
 
18
60
  return $this
19
- ->subject('【service_name】' . $title)
61
+ ->subject('【ikimasu】' . $title)
20
62
  ->text('emails.request', [
21
63
  'user' => $this->user,
22
64
  'url' => $url
23
65
  ]);
66
+ }
67
+ }
24
68
 
25
69
  ```
26
70