diff --git a/backend/app/Http/Controllers/Api/ChildrenController.php b/backend/app/Http/Controllers/Api/ChildrenController.php index 1b780ba9..f61f12f9 100644 --- a/backend/app/Http/Controllers/Api/ChildrenController.php +++ b/backend/app/Http/Controllers/Api/ChildrenController.php @@ -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] = []; } } diff --git a/backend/app/Http/Controllers/Api/MeetingsController.php b/backend/app/Http/Controllers/Api/MeetingsController.php index 51247f10..b9fd33bf 100644 --- a/backend/app/Http/Controllers/Api/MeetingsController.php +++ b/backend/app/Http/Controllers/Api/MeetingsController.php @@ -526,17 +526,22 @@ class MeetingsController extends Controller { if (isset($r->pdf)) { $filename = uniqid() . '.pdf'; $pdf = base64_decode(substr($r->pdf, strpos($r->pdf, ',') + 1)); - $update['pdf'] = '/storage/'.$filename; - if ($chk = Meeting::select('pdf')->where('id', (int)$meeting_id)->first() && strcmp($chk->pdf, $r->pdf) != 0) { - if (Storage::disk('public')->exists($chk->pdf)) { - if (Storage::disk('public')->get($chk->pdf) != $pdf) { - Storage::disk('public')->delete($chk->pdf); + if ($chk = Meeting::select('pdf')->where('id', (int)$meeting_id)->first()) { + $opdf = str_replace('/storage/', '', $chk->pdf); + if (strcmp(Storage::disk('public')->get($opdf), $pdf) !== 0) { + if (Storage::disk('public')->exists($opdf)) { + Storage::disk('public')->delete($opdf); } + + $update['pdf'] = '/storage/'.$filename; + Storage::disk('public')->put($filename, $pdf); } } - - Storage::disk('public')->put($filename, $pdf); + else { + $update['pdf'] = '/storage/'.$filename; + Storage::disk('public')->put($filename, $pdf); + } } Meeting::where('id', (int)$meeting_id)->update($update); diff --git a/infra/nginx/default.conf b/infra/nginx/default.conf index a4cc9ba9..9734145a 100644 --- a/infra/nginx/default.conf +++ b/infra/nginx/default.conf @@ -10,6 +10,7 @@ server { index index.php; charset utf-8; + client_max_body_size 10M; location / { try_files $uri $uri/ /index.php?$query_string;