メール
このコミットが含まれているのは:
コミット
f29b54a440
|
@ -502,10 +502,10 @@ class FathersController extends Controller {
|
|||
foreach (json_decode($r->email) as $email) {
|
||||
// メールを送ります。
|
||||
if (request()->route()->action['as'] == 'cmnotifynew') {
|
||||
Mail::to($email)->send(new FathersApprovalMail());
|
||||
Mail::to($email)->send(new FathersApprovalMail(session()->get('fathers')['company'], $r->meeting_id));
|
||||
}
|
||||
else if (request()->route()->action['as'] == 'cmnotifyedit') {
|
||||
Mail::to($email)->send(new FathersApprovalAgainMail());
|
||||
Mail::to($email)->send(new FathersApprovalAgainMail(session()->get('fathers')['company'], $r->meeting_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,13 +5,18 @@ namespace App\Http\Controllers\Api;
|
|||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Models\Father;
|
||||
use App\Models\Child;
|
||||
use App\Models\Meeting;
|
||||
use App\Models\MeetingApprovals;
|
||||
use App\Models\FatherRelation;
|
||||
|
||||
use App\Mail\MeetingEditNotification;
|
||||
use App\Mail\MeetingEditAwareness;
|
||||
|
||||
class MeetingApprovalsController extends Controller {
|
||||
public function countNonApproval (Request $r) {
|
||||
return MeetingApprovals::where('child_id', session()->get('children')['id'])->whereNull('approval_at')->count();
|
||||
|
@ -49,8 +54,13 @@ class MeetingApprovalsController extends Controller {
|
|||
|
||||
try {
|
||||
foreach (json_decode($r->children) as $child) {
|
||||
if (null === ($c = Child::where('id', (int)$child)->first())) {
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
|
||||
$create['child_id'] = $child;
|
||||
MeetingApprovals::create($create);
|
||||
Mail::to($c->email)->send(new MeetingEditNotification(session()->get('fathers')['company'], $r->meeting_id));
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
Log::critical($e->getMessage());
|
||||
|
@ -93,11 +103,20 @@ class MeetingApprovalsController extends Controller {
|
|||
return ['status_code' => 400, 'error_messages' => ['承認に失敗しました。']];
|
||||
}
|
||||
|
||||
if (null === ($meet = Meeting::where('id', (int)$r->meeting_id)->first())) {
|
||||
return ['status_code' => 400, 'error_messages' => ['承認に失敗しました。']];
|
||||
}
|
||||
|
||||
if (null === ($father = Father::where('id', (int)$meet->father_id)->first())) {
|
||||
return ['status_code' => 400, 'error_messages' => ['承認に失敗しました。']];
|
||||
}
|
||||
|
||||
// $update = ['approval_at' => null];
|
||||
$update = ['approval_at' => date('Y-m-d H:i:s')];
|
||||
|
||||
try {
|
||||
MeetingApprovals::where('meeting_id', (int)$r->meeting_id)->where('child_id', (int)$r->child_id)->update($update);
|
||||
Mail::to($father->email)->send(new MeetingEditAwareness(session()->get('children')['last_name'], session()->get('children')['first_name'], $r->meeting_id));
|
||||
} catch (\Throwable $e) {
|
||||
// 失敗
|
||||
Log::critical($e->getMessage());
|
||||
|
|
|
@ -703,7 +703,7 @@ class MeetingsController extends Controller {
|
|||
|
||||
if (count(Storage::disk('private')->files('/')) >= 9999) {
|
||||
Log::critical('ストレージの限界を超えています。9999個ファイルまで保存可能ですので、不要なファイルを削除して下さい。');
|
||||
return ['status_code' => 400, 'error_messages' => ['親の更新に失敗しました。']];
|
||||
return ['status_code' => 400, 'error_messages' => ['ミーティングの更新に失敗しました。']];
|
||||
}
|
||||
|
||||
// ファイルサイズは50MiB以内
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class MeetingEditAwareness extends Mailable {
|
||||
use Queueable, SerializesModels;
|
||||
private $last_name;
|
||||
private $first_name;
|
||||
private $meeting_id;
|
||||
|
||||
public function __construct ($last_name, $first_name, $meeting_id) {
|
||||
$this->last_name = $last_name;
|
||||
$this->first_name = $first_name;
|
||||
$this->meeting_id = $meeting_id;
|
||||
}
|
||||
|
||||
public function build () {
|
||||
return $this->subject('KIKI運営事務局からのお知らせ')->markdown('emails.fathers.meetingawareness', [
|
||||
'last_name' => $this->last_name,
|
||||
'first_name' => $this->first_name,
|
||||
'meeting_id' => $this->meeting_id,
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class MeetingEditNotification extends Mailable {
|
||||
use Queueable, SerializesModels;
|
||||
private $father;
|
||||
private $meeting_id;
|
||||
|
||||
public function __construct ($father, $meeting_id) {
|
||||
$this->father = $father;
|
||||
$this->meeting_id = $meeting_id;
|
||||
}
|
||||
|
||||
public function build () {
|
||||
return $this->subject('KIKI運営事務局からのお知らせ')->markdown('emails.fathers.meetingedit', [
|
||||
'father' => $this->father,
|
||||
'meeting_id' => $this->meeting_id,
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
@component('mail::message')
|
||||
# KIKI運営事務局からのお知らせ
|
||||
|
||||
{{ $last_name }} {{ $first_name }}さんが承知完了しました。
|
||||
|
||||
承知した内容のご確認はこちら
|
||||
|
||||
@component('mail::button', ['url' => url('/').'/p-account/meeting/detail/'.$meeting_id])
|
||||
{{ url('/') }}/p-account/meeting/detail/{{ $meeting_id }}
|
||||
@endcomponent
|
||||
|
||||
KIKI運営事務局
|
||||
@endcomponent
|
|
@ -0,0 +1,13 @@
|
|||
@component('mail::message')
|
||||
# KIKI運営事務局からのお知らせ
|
||||
|
||||
{{ $father }}さんより 案件再編集のお知らせ
|
||||
|
||||
案件編集内容のご確認ははこちら
|
||||
|
||||
@component('mail::button', ['url' => url('/').'/c-account/meeting/detail/'.$meeting_id])
|
||||
{{ url('/') }}/c-account/meeting/detail/{{ $meeting_id }}
|
||||
@endcomponent
|
||||
|
||||
KIKI運営事務局
|
||||
@endcomponent
|
新しいイシューから参照