子Cは登録完了、ただしリレーション(father_relations)は行われない
このコミットが含まれているのは:
コミット
b46ac2b59a
|
@ -123,15 +123,6 @@ class ChildrenController extends Controller {
|
|||
return ['status_code' => 400, 'error_messages' => ['仮登録の有効期限が切れました。改めて親にお問い合わせいただき、再登録の手続きを行ってください。']];
|
||||
}
|
||||
|
||||
// 親子関係の上限の場合
|
||||
if (!is_null($get->father_id) && null !== ($rel = FatherRelation::where('father_id', $get->father_id)->first())) {
|
||||
$fa = Father::select('relation_limit')->where('id', $get->father_id)->first();
|
||||
$fr = FatherRelation::where('father_id', $get->father_id)->count();
|
||||
if (null !== $fa && $fr >= $fa->relation_limit) {
|
||||
return ['status_code' => 400, 'error_messages' => ['仮登録の有効期限が切れました。改めて親にお問い合わせいただき、再登録の手続きを行ってください。']];
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_null($r->image) && count(Storage::disk('private')->files('/')) >= 9999) {
|
||||
Log::critical('ストレージの限界を超えています。9999個ファイルまで保存可能ですので、不要なファイルを削除して下さい。');
|
||||
return ['status_code' => 400, 'error_messages' => ['登録に失敗しました。']];
|
||||
|
@ -204,30 +195,35 @@ class ChildrenController extends Controller {
|
|||
$child->push();
|
||||
|
||||
if (!is_null($telact->father_id)) {
|
||||
$rel = new FatherRelation;
|
||||
// 親子関係の上限ではないの場合
|
||||
$fa = Father::select('relation_limit')->where('id', $get->father_id)->first();
|
||||
$fr = FatherRelation::where('father_id', $get->father_id)->count();
|
||||
if ($fr < $fa->relation_limit) {
|
||||
$rel = new FatherRelation;
|
||||
|
||||
$add = [
|
||||
'father_id' => $telact->father_id,
|
||||
'child_id' => $child->id,
|
||||
'hire_at' => date('Y-m-d H:i:s', time()),
|
||||
];
|
||||
$add = [
|
||||
'father_id' => $telact->father_id,
|
||||
'child_id' => $child->id,
|
||||
'hire_at' => date('Y-m-d H:i:s', time()),
|
||||
];
|
||||
|
||||
if (null !== ($meet = Meeting::select('id')->where('father_id', $telact->father_id)->where('is_favorite', true)->get())) {
|
||||
foreach ($meet as $m) {
|
||||
$app = new MeetingApprovals;
|
||||
if (null !== ($meet = Meeting::select('id')->where('father_id', $telact->father_id)->where('is_favorite', true)->get())) {
|
||||
foreach ($meet as $m) {
|
||||
$app = new MeetingApprovals;
|
||||
|
||||
$join = [
|
||||
'child_id' => $child->id,
|
||||
'meeting_id' => $m->id,
|
||||
];
|
||||
$join = [
|
||||
'child_id' => $child->id,
|
||||
'meeting_id' => $m->id,
|
||||
];
|
||||
|
||||
$app->fill($join);
|
||||
$app->push();
|
||||
$app->fill($join);
|
||||
$app->push();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rel->fill($add);
|
||||
$rel->push();
|
||||
$rel->fill($add);
|
||||
$rel->push();
|
||||
}
|
||||
}
|
||||
|
||||
$telact->delete();
|
||||
|
|
|
@ -30,10 +30,6 @@ class FatherRelationsController extends Controller {
|
|||
|
||||
$father = Father::select('relation_limit')->where('id', $father_id)->first();
|
||||
|
||||
if ($father->relation_limit <= FatherRelation::select('id')->where('father_id', $father_id)->count()) {
|
||||
return ['status_code' => 401, 'error_messages' => ['契約上限数に達した為、メンバー追加できません。']];
|
||||
}
|
||||
|
||||
return ['status_code' => 200];
|
||||
}
|
||||
|
||||
|
@ -59,7 +55,7 @@ class FatherRelationsController extends Controller {
|
|||
}
|
||||
|
||||
if ($father->relation_limit <= FatherRelation::select('id')->where('father_id', (int)$r->father_id)->count()) {
|
||||
return ['status_code' => 401, 'error_messages' => ['契約上限数に達した為、メンバー追加できません。']];
|
||||
return ['status_code' => 200, 'success_messages' => ['子の追加に成功しました。'], 'params' => ['child_id' => $child->id, 'limit' => $father->relation_limit]];
|
||||
}
|
||||
|
||||
$create = [
|
||||
|
|
新しいイシューから参照