Merge branch 'apifixmore' of https://github.com/nakazawakan/kikikanri into frontend

このコミットが含まれているのは:
dragon1211 2021-10-29 22:21:27 +09:00
コミット 9982f64768
7個のファイルの変更22行の追加22行の削除

ファイルの表示

@ -363,7 +363,20 @@ class FathersController extends Controller {
return ['status_code' => 200, 'success_messages' => ['親の更新に成功しました。']];
}
public function withdrawal ($father_id) {
public function withdrawal (Request $r) {
try {
Father::where('id', (int)$r->father_id)->delete();
} catch (\Throwable $e) {
// 失敗
Log::critical($e->getMessage());
return ['status_code' => 400, 'error_messages' => ['親の削除に失敗しました。']];
}
// 成功
return ['status_code' => 200, 'success_messages' => ['親の削除に成功しました。']];
}
public function delete ($father_id) {
try {
Father::where('id', (int)$father_id)->delete();
} catch (\Throwable $e) {
@ -375,17 +388,4 @@ class FathersController extends Controller {
// 成功
return ['status_code' => 200, 'success_messages' => ['親の削除に成功しました。']];
}
public function delete ($meeting_id) {
try {
Meeting::where('id', (int)$meeting_id)->delete();
} catch (\Throwable $e) {
// 失敗
Log::critical($e->getMessage());
return ['status_code' => 400, 'error_messages' => ['親の削除に失敗しました。']];
}
// 成功
return ['status_code' => 200, 'success_messages' => ['親の削除に成功しました。']];
}
}

ファイルの表示

@ -17,7 +17,7 @@ class CreateTelActivationsTable extends Migration
$table->id();
$table->unsignedTinyInteger('type');
$table->unsignedBigInteger('child_id')->nullable();
$table->foreign('child_id')->references('id')->on('children');
$table->foreign('child_id')->references('id')->on('children')->onDelete('cascade');
$table->string('tel', 11)->unique();
$table->string('token', 100);
$table->dateTime('ttl');

ファイルの表示

@ -16,9 +16,9 @@ class CreateFatherRelationsTable extends Migration
Schema::create('father_relations', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('father_id');
$table->foreign('father_id')->references('id')->on('fathers');
$table->foreign('father_id')->references('id')->on('fathers')->onDelete('cascade');
$table->unsignedBigInteger('child_id');
$table->foreign('child_id')->references('id')->on('children');
$table->foreign('child_id')->references('id')->on('children')->onDelete('cascade');
$table->dateTime('hire_at')->useCurrent();
$table->timestamps();
});

ファイルの表示

@ -16,7 +16,7 @@ class CreateMeetingsTable extends Migration
Schema::create('meetings', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('father_id');
$table->foreign('father_id')->references('id')->on('fathers');
$table->foreign('father_id')->references('id')->on('fathers')->onDelete('cascade');
$table->string('title', 255);
$table->string('text', 2000);
$table->string('pdf', 255)->nullable();

ファイルの表示

@ -16,7 +16,7 @@ class CreateMeetingImagesTable extends Migration
Schema::create('meeting_images', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('meeting_id');
$table->foreign('meeting_id')->references('id')->on('meetings');
$table->foreign('meeting_id')->references('id')->on('meetings')->onDelete('cascade');
$table->string('image');
$table->timestamps();
});

ファイルの表示

@ -16,9 +16,9 @@ class CreateMeetingApprovalsTable extends Migration
Schema::create('meeting_approvals', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('child_id');
$table->foreign('child_id')->references('id')->on('children');
$table->foreign('child_id')->references('id')->on('children')->onDelete('cascade');
$table->unsignedBigInteger('meeting_id');
$table->foreign('meeting_id')->references('id')->on('meetings');
$table->foreign('meeting_id')->references('id')->on('meetings')->onDelete('cascade');
$table->dateTime('approval_at')->nullable();
$table->timestamps();
});

ファイルの表示

@ -17,7 +17,7 @@ class CreateSmssesTable extends Migration
$table->id();
$table->unsignedTinyInteger('send_id');
$table->unsignedBigInteger('receive_id');
$table->foreign('receive_id')->references('id')->on('children');
$table->foreign('receive_id')->references('id')->on('children')->onDelete('cascade');
$table->unsignedTinyInteger('is_sent')->default(0);
$table->timestamps();
});