リレーションの修正
このコミットが含まれているのは:
コミット
cf7bcc4e10
|
@ -15,17 +15,18 @@ use App\Models\Meeting;
|
|||
use App\Models\MeetingApprovals;
|
||||
|
||||
class FatherRelationsController extends Controller {
|
||||
public function check (Request $r) {
|
||||
|
||||
$father_id = (int)$r->father_id;
|
||||
|
||||
if (FatherRelation::select('id')->where('father_id', $father_id)->count() == 0) {
|
||||
public function checkNull () {
|
||||
if (FatherRelation::select('id')->where('father_id', (int)session()->get('fathers')['id'])->count() == 0) {
|
||||
return ['status_code' => 401, 'error_messages' => ['契約上限数に達した為、メンバー追加できません。']];
|
||||
}
|
||||
|
||||
$father = Father::select('relation_limit')->where('id', $father_id)->first();
|
||||
return ['status_code' => 200];
|
||||
}
|
||||
|
||||
if ($father->relation_limit <= FatherRelation::select('id')->where('father_id', $father_id)->count()) {
|
||||
public function check () {
|
||||
$father = Father::select('relation_limit')->where('id', (int)session()->get('fathers')['id'])->first();
|
||||
|
||||
if ($father->relation_limit <= FatherRelation::select('id')->where('father_id', (int)session()->get('fathers')['id'])->count()) {
|
||||
return ['status_code' => 401, 'error_messages' => ['契約上限数に達した為、メンバー追加できません。']];
|
||||
}
|
||||
|
||||
|
|
|
@ -447,7 +447,7 @@ class MeetingsController extends Controller {
|
|||
$child_select = ['image'];
|
||||
|
||||
// 取得に成功
|
||||
if (null === ($list = Meeting::select($meeting_select)->where('father_id', (int)session()->get('fathers')['id'])->where('is_favorite', 0)->orderBy('created_at', 'desc')->get())) {
|
||||
if (null === ($list = Meeting::select($meeting_select)->where('father_id', (int)session()->get('fathers')['id'])->where('is_favorite', 0)->orderBy('updated_at', 'desc')->get())) {
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
|
||||
|
|
|
@ -143,6 +143,7 @@ Route::group(['prefix' => 'fathers'], function () {
|
|||
|
||||
// FatherRelationsController
|
||||
Route::group(['prefix' => 'relations'], function () {
|
||||
Route::get('/checkNull', '\App\Http\Controllers\Api\FatherRelationsController@checkNull');
|
||||
Route::get('/check', '\App\Http\Controllers\Api\FatherRelationsController@check');
|
||||
Route::post('/register', '\App\Http\Controllers\Api\FatherRelationsController@register');
|
||||
Route::put('/updateHireDate/{child_id}', '\App\Http\Controllers\Api\FatherRelationsController@updateHireDate');
|
||||
|
|
新しいイシューから参照