MeetingsControllerのGETの全部
このコミットが含まれているのは:
コミット
6280e230f2
|
@ -222,15 +222,160 @@ class MeetingsController extends Controller {
|
|||
return ['status_code' => 400];
|
||||
}
|
||||
|
||||
public function searchOfApprovalOfChild (Request $r) {}
|
||||
public function searchOfApprovalOfChild (Request $r) {
|
||||
if (!isset($r->child_id)) {
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
if (!isset($r->keyword)) {
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
|
||||
public function searchOfNonApprovalOfChild (Request $r) {}
|
||||
$result = [];
|
||||
$meeting_select = ['id', 'father_id', 'title', 'text', 'memo', 'updated_at'];
|
||||
$father_select = ['image', 'company'];
|
||||
$meeting_approvals_select = ['approval_at as date'];
|
||||
|
||||
public function searchOfCompleteofFather (Request $r) {}
|
||||
// 取得に成功
|
||||
if ($list = Meeting::select($meeting_select)->where('title', 'LIKE', '%'.$r->keyword.'%')->orWhere('text', 'LIKE', '%'.$r->keyword.'%')->get()) {
|
||||
foreach ($list as $i => $l) {
|
||||
$result[] = $l;
|
||||
$result[$i]['father'] = Father::select($father_select)->where('id', $l['father_id'])->first();
|
||||
$result[$i]['approval'] = MeetingApprovals::select($meeting_approvals_select)->where('child_id', $r->child_id)->whereNotNull('approval_at')->get();
|
||||
}
|
||||
|
||||
public function searchOfIncompleteofFather (Request $r) {}
|
||||
return ['status_code' => 200, 'params' => $result];
|
||||
}
|
||||
|
||||
public function detail ($meeting_id) {}
|
||||
// 取得に失敗
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
|
||||
public function searchOfNonApprovalOfChild (Request $r) {
|
||||
if (!isset($r->child_id)) {
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
if (!isset($r->keyword)) {
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
|
||||
$result = [];
|
||||
$meeting_select = ['id', 'father_id', 'title', 'text', 'memo', 'updated_at'];
|
||||
$father_select = ['image', 'company'];
|
||||
$meeting_approvals_select = ['approval_at as date'];
|
||||
|
||||
// 取得に成功
|
||||
if ($list = Meeting::select($meeting_select)->where('title', 'LIKE', '%'.$r->keyword.'%')->orWhere('text', 'LIKE', '%'.$r->keyword.'%')->get()) {
|
||||
foreach ($list as $i => $l) {
|
||||
$result[] = $l;
|
||||
$result[$i]['father'] = Father::select($father_select)->where('id', $l['father_id'])->first();
|
||||
$result[$i]['approval'] = MeetingApprovals::select($meeting_approvals_select)->where('child_id', $r->child_id)->whereNull('approval_at')->get();
|
||||
}
|
||||
|
||||
return ['status_code' => 200, 'params' => $result];
|
||||
}
|
||||
|
||||
// 取得に失敗
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
|
||||
public function searchOfCompleteofFather (Request $r) {
|
||||
$r->father_id = 1;
|
||||
$r->keyword = '母';
|
||||
if (!isset($r->father_id)) {
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
if (!isset($r->keyword)) {
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
|
||||
$result = [];
|
||||
$meeting_select = ['id', 'father_id', 'title', 'text', 'memo', 'updated_at'];
|
||||
$meeting_images_select = ['image'];
|
||||
$meeting_approvals_select = ['approval_at', 'child_id'];
|
||||
$child_select = ['image'];
|
||||
|
||||
// 取得に成功
|
||||
if ($list = Meeting::select($meeting_select)->where('father_id', $r->father_id)->where('title', 'LIKE', '%'.$r->keyword.'%')->orWhere('text', 'LIKE', '%'.$r->keyword.'%')->get()) {
|
||||
foreach ($list as $i => $l) {
|
||||
$result[] = $l;
|
||||
$result[$i]['meeting_image'] = MeetingImage::select($meeting_images_select)->where('meeting_id', $l['id'])->get();
|
||||
$result[$i]['meeting_approvals'] = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', $l['id'])->whereNull('approval_at')->get();
|
||||
|
||||
foreach ($result[$i]['meeting_approvals'] as $ii => $ra) {
|
||||
$result[$i]['meeting_approvals'][$ii]['child'] = Child::select($child_select)->where('id', $result[$i]['meeting_approvals'][$ii]['child_id'])->first();
|
||||
}
|
||||
}
|
||||
|
||||
return ['status_code' => 200, 'params' => $result];
|
||||
}
|
||||
|
||||
// 取得に失敗
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
|
||||
public function searchOfIncompleteofFather (Request $r) {
|
||||
if (!isset($r->father_id)) {
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
if (!isset($r->keyword)) {
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
|
||||
$result = [];
|
||||
$meeting_select = ['id', 'father_id', 'title', 'text', 'memo', 'updated_at'];
|
||||
$meeting_images_select = ['image'];
|
||||
$meeting_approvals_select = ['approval_at', 'child_id'];
|
||||
$child_select = ['image'];
|
||||
|
||||
// 取得に成功
|
||||
if ($list = Meeting::select($meeting_select)->where('father_id', $r->father_id)->where('title', 'LIKE', '%'.$r->keyword.'%')->orWhere('text', 'LIKE', '%'.$r->keyword.'%')->get()) {
|
||||
foreach ($list as $i => $l) {
|
||||
$result[] = $l;
|
||||
$result[$i]['meeting_image'] = MeetingImage::select($meeting_images_select)->where('meeting_id', $l['id'])->get();
|
||||
$result[$i]['meeting_approvals'] = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', $l['id'])->whereNotNull('approval_at')->get();
|
||||
|
||||
foreach ($result[$i]['meeting_approvals'] as $ii => $ra) {
|
||||
$result[$i]['meeting_approvals'][$ii]['child'] = Child::select($child_select)->where('id', $result[$i]['meeting_approvals'][$ii]['child_id'])->first();
|
||||
}
|
||||
}
|
||||
|
||||
return ['status_code' => 200, 'params' => $result];
|
||||
}
|
||||
|
||||
// 取得に失敗
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
|
||||
public function detail (Request $r, $meeting_id) {
|
||||
$r->father_id = 1;
|
||||
if (!isset($r->father_id)) {
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
|
||||
$result = [];
|
||||
$meeting_select = ['id', 'father_id', 'title', 'text', 'memo', 'pdf', 'updated_at'];
|
||||
$meeting_images_select = ['image'];
|
||||
$meeting_approvals_select = ['approval_at', 'child_id'];
|
||||
$child_select = ['image'];
|
||||
|
||||
// 取得に成功
|
||||
if ($list = Meeting::select($meeting_select)->where('id', $meeting_id)->where('father_id', $r->father_id)->get()) {
|
||||
foreach ($list as $i => $l) {
|
||||
$result[] = $l;
|
||||
$result[$i]['meeting_image'] = MeetingImage::select($meeting_images_select)->where('meeting_id', $l['id'])->get();
|
||||
$result[$i]['meeting_approvals'] = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', $l['id'])->whereNotNull('approval_at')->get();
|
||||
|
||||
foreach ($result[$i]['meeting_approvals'] as $ii => $ra) {
|
||||
$result[$i]['meeting_approvals'][$ii]['child'] = Child::select($child_select)->where('id', $result[$i]['meeting_approvals'][$ii]['child_id'])->first();
|
||||
}
|
||||
}
|
||||
|
||||
return ['status_code' => 200, 'params' => $result];
|
||||
}
|
||||
|
||||
// 取得に失敗
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
|
||||
public function delete ($meeting_id) {
|
||||
// 削除成功
|
||||
|
|
|
@ -43,11 +43,11 @@ Route::get('/meetings/listOfCompleteOfFather/', '\App\Http\Controllers\Api\Meeti
|
|||
Route::get('/meetings/listOfIncompleteOfFather/', '\App\Http\Controllers\Api\MeetingsController@listOfIncompleteOfFather');
|
||||
Route::get('/meetings/listOfFavoriteOfFather/', '\App\Http\Controllers\Api\MeetingsController@listOfFavoriteOfFather');
|
||||
Route::get('/meetings/listOfNonFavoriteOfFather/', '\App\Http\Controllers\Api\MeetingsController@listOfNonFavoriteOfFather');
|
||||
// Route::get('/meetings/searchOfApprovalOfChild/', '\App\Http\Controllers\Api\MeetingsController@searchOfApprovalOfChild');
|
||||
// Route::get('/meetings/searchOfNonApprovalOfChild/', '\App\Http\Controllers\Api\MeetingsController@searchOfNonApprovalOfChild');
|
||||
// Route::get('/meetings/searchOfCompleteOfFather/', '\App\Http\Controllers\Api\MeetingsController@searchOfCompleteOfFather');
|
||||
// Route::get('/meetings/searchOfIncompleteOfFather/', '\App\Http\Controllers\Api\MeetingsController@searchOfIncompleteOfFather');
|
||||
// Route::get('/meetings/detail/{meeting_id}', '\App\Http\Controllers\Api\MeetingsController@detail');
|
||||
Route::get('/meetings/searchOfApprovalOfChild/', '\App\Http\Controllers\Api\MeetingsController@searchOfApprovalOfChild');
|
||||
Route::get('/meetings/searchOfNonApprovalOfChild/', '\App\Http\Controllers\Api\MeetingsController@searchOfNonApprovalOfChild');
|
||||
Route::get('/meetings/searchOfCompleteOfFather/', '\App\Http\Controllers\Api\MeetingsController@searchOfCompleteOfFather');
|
||||
Route::get('/meetings/searchOfIncompleteOfFather/', '\App\Http\Controllers\Api\MeetingsController@searchOfIncompleteOfFather');
|
||||
Route::get('/meetings/detail/{meeting_id}', '\App\Http\Controllers\Api\MeetingsController@detail');
|
||||
Route::delete('/meetings/delete/{meeting_id}', '\App\Http\Controllers\Api\MeetingsController@delete');
|
||||
Route::delete('/meetings/deleteRelationFather/{father_id}', '\App\Http\Controllers\Api\MeetingsController@deleteRelationFather');
|
||||
|
||||
|
|
新しいイシューから参照