しゅうせい
このコミットが含まれているのは:
コミット
656df20d02
|
@ -35,17 +35,19 @@ class FatherRelationsController extends Controller {
|
|||
];
|
||||
|
||||
try {
|
||||
FatherRelation::create($create);
|
||||
if (null === ($fr = FatherRelation::where('father_id', $r->father_id)->where('child_id', $child->id)->first())) {
|
||||
FatherRelation::create($create);
|
||||
}
|
||||
else {
|
||||
FatherRelation::update($create);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
// 失敗
|
||||
Log::critical($e->getMessage());
|
||||
return ['status_code' => 400, 'error_messages' => ['子の追加に失敗しました。']];
|
||||
}
|
||||
|
||||
return ['status_code' => 200, 'success_messages' => ['子の追加に成功しました。'], 'params' => ['child_id' => $child_id]];
|
||||
|
||||
// 1.POSTで受け取ったidentityと紐づくchildrenのデータのidを取得。
|
||||
// 2.1で取得したidとPOSTで受け取ったfather_idをfather_relatoinsに登録。(hire_atはPOST時の日時)
|
||||
return ['status_code' => 200, 'success_messages' => ['子の追加に成功しました。'], 'params' => ['child_id' => $child->id]];
|
||||
}
|
||||
|
||||
public function updateHireDate (Request $r, $child_id) {
|
||||
|
|
|
@ -21,13 +21,15 @@ class MeetingsController extends Controller {
|
|||
return ['status_code' => 400, 'error_messages' => ['ミーティングの登録に失敗しました。']];
|
||||
}
|
||||
|
||||
// tmp
|
||||
/////////////////////////
|
||||
if (isset($r->image)) {
|
||||
$r->image = json_decode($r->image);
|
||||
}
|
||||
|
||||
// ファイルサイズは10MiB以内
|
||||
Validator::extend('image_size', function ($attribute, $value, $params, $validator) {
|
||||
try {
|
||||
$ok = true;
|
||||
foreach ($value as $v) {
|
||||
foreach (json_decode($value) as $v) {
|
||||
if (strlen(base64_decode($v)) > 1048576) {
|
||||
$ok = false;
|
||||
}
|
||||
|
@ -43,11 +45,11 @@ class MeetingsController extends Controller {
|
|||
Validator::extend('image_meme', function ($attribute, $value, $params, $validator) {
|
||||
try {
|
||||
$ok = true;
|
||||
foreach ($value as $v) {
|
||||
foreach (json_decode($value) as $v) {
|
||||
if (
|
||||
mime_content_type($v) == 'image/jpeg' || // jpg
|
||||
mime_content_type($v) == 'image/png' || // png
|
||||
mime_content_type($v) == 'image/gif' // gif
|
||||
mime_content_type($v) != 'image/jpeg' && // jpg
|
||||
mime_content_type($v) != 'image/png' && // png
|
||||
mime_content_type($v) != 'image/gif' // gif
|
||||
) {
|
||||
$ok = false;
|
||||
}
|
||||
|
@ -58,7 +60,6 @@ class MeetingsController extends Controller {
|
|||
return false;
|
||||
}
|
||||
});
|
||||
/////////////////////////
|
||||
|
||||
// ミームタイプ
|
||||
Validator::extend('pdf_meme', function ($attribute, $value, $params, $validator) {
|
||||
|
@ -75,7 +76,7 @@ class MeetingsController extends Controller {
|
|||
'text' => 'required|max:2000',
|
||||
'memo' => 'max:2000',
|
||||
'pdf' => 'pdf_meme',
|
||||
'image' => 'image_size|image_meme', // tmp
|
||||
'image' => 'image_size|image_meme',
|
||||
]);
|
||||
|
||||
if ($validate->fails()) {
|
||||
|
@ -98,10 +99,8 @@ class MeetingsController extends Controller {
|
|||
Storage::disk('public')->put($filename, $pdf);
|
||||
}
|
||||
|
||||
$id = Meeting::create($insert);
|
||||
$meeting = Meeting::create($insert);
|
||||
|
||||
// tmp
|
||||
/////////////////////////
|
||||
foreach ($r->image as $img) {
|
||||
$ext = explode('/', mime_content_type($img))[1];
|
||||
$filename = uniqid() . '.'.$ext;
|
||||
|
@ -109,25 +108,24 @@ class MeetingsController extends Controller {
|
|||
Storage::disk('public')->put($filename, $image);
|
||||
|
||||
$insert_image = [
|
||||
'meeting_id' => (int)$id,
|
||||
'meeting_id' => (int)$meeting->id,
|
||||
'image' => '/storage/'.$filename,
|
||||
];
|
||||
|
||||
MeetingImage::create($insert_image);
|
||||
}
|
||||
/////////////////////////
|
||||
|
||||
foreach ($r->children as $child) {
|
||||
foreach (json_decode($r->children) as $child) {
|
||||
$insert_approval = [
|
||||
'child_id' => $child,
|
||||
'meeting_id' => (int)$id,
|
||||
'meeting_id' => (int)$meeting->id,
|
||||
'approval_at' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
|
||||
MeetingApprovals::create($insert_approval);
|
||||
}
|
||||
|
||||
$params = ['meeting_id' => $id];
|
||||
$params = ['meeting_id' => $meeting->id];
|
||||
} catch (\Throwable $e) {
|
||||
// 失敗
|
||||
Log::critical($e->getMessage());
|
||||
|
|
|
@ -21,6 +21,11 @@ class NoticeIncomplete
|
|||
$response = $next($request);
|
||||
$count = 0;
|
||||
|
||||
if (is_null(session()->get('fathers'))) {
|
||||
session()->forget('fathers');
|
||||
return $response;
|
||||
}
|
||||
|
||||
if (null !== ($list = Meeting::select('id')->where('father_id', (int)session()->get('fathers')['id'])->get())) {
|
||||
foreach ($list as $i => $l) {
|
||||
if (null === ($apr = MeetingApprovals::select('id')->where('meeting_id', (int)$l->id)->get())) {
|
||||
|
|
新しいイシューから参照