コミット
554aade1ae
|
@ -180,17 +180,20 @@ class ChildrenController extends Controller {
|
|||
return ['status_code' => 200, 'params' => $result];
|
||||
}
|
||||
|
||||
public function listOfFather (Request $r) {
|
||||
public function listOfFather ($father_id) {
|
||||
if (!isset($father_id)) {
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
$result = [];
|
||||
$child_select = ['id', 'image', 'last_name', 'first_name'];
|
||||
$child_select = ['first_name', 'last_name', 'tel'];
|
||||
|
||||
if (null === ($list = FatherRelation::select('father_id')->where('father_id', (int)$r->father_id)->orderBy('created_at', 'desc')->get())) {
|
||||
if (null === ($list = FatherRelation::select('child_id')->where('father_id', (int)$father_id)->orderBy('created_at', 'desc')->get())) {
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
|
||||
foreach ($list as $l) {
|
||||
if (null === ($result[] = Child::select($child_select)->find($l->father_id))) {
|
||||
return ['status_code' => 400];
|
||||
foreach ($list as $i => $l) {
|
||||
if (null === ($result[] = Child::select($child_select)->where('id', $l->child_id)->first())) {
|
||||
$result[$i] = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
新しいイシューから参照