detailに配列の追加
このコミットが含まれているのは:
コミット
e02124efe9
|
@ -13,6 +13,7 @@ use App\Models\MeetingImage;
|
|||
use App\Models\MeetingApprovals;
|
||||
use App\Models\Child;
|
||||
use App\Models\Father;
|
||||
use App\Models\FatherRelation;
|
||||
|
||||
class MeetingsController extends Controller {
|
||||
public function register (Request $r) {
|
||||
|
@ -468,6 +469,7 @@ class MeetingsController extends Controller {
|
|||
$meeting_images_select = ['id', 'image'];
|
||||
$meeting_approvals_select = ['approval_at', 'child_id'];
|
||||
$child_select = ['image', 'last_name', 'first_name'];
|
||||
$all_child_select = ['id as child_id', 'last_name', 'first_name'];
|
||||
|
||||
// 取得に成功
|
||||
if (null === ($result = Meeting::select($meeting_select)->where('id', (int)$meeting_id)->first())) {
|
||||
|
@ -475,10 +477,16 @@ class MeetingsController extends Controller {
|
|||
}
|
||||
|
||||
if (null === ($result->meeting_image = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$result->id)->get())) {
|
||||
return ['status_code' => 400];
|
||||
$result->meeting_image = [];
|
||||
}
|
||||
if (null === ($result->approval = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$result->id)->whereNotNull('approval_at')->get())) {
|
||||
return ['status_code' => 400];
|
||||
$result->approval = [];
|
||||
}
|
||||
|
||||
if (null !== ($rel = FatherRelation::select('child_id')->where('father_id', (int)$result->father_id)->first())) {
|
||||
if (null === ($result->children = Child::select($all_child_select)->where('id', $rel->child_id)->get()->toArray())) {
|
||||
$result->children = [];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($result->approval as $i => $a) {
|
||||
|
|
新しいイシューから参照