2021-09-28 14:38:41 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
|
2021-10-21 19:47:39 +09:00
|
|
|
use App\Http\Controllers\Controller, Session;
|
2021-10-15 10:37:47 +09:00
|
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
|
use Illuminate\Support\Facades\Hash;
|
2021-09-28 14:38:41 +09:00
|
|
|
use Illuminate\Http\Request;
|
2021-10-15 10:37:47 +09:00
|
|
|
use Illuminate\Support\Facades\Log;
|
2021-10-21 10:38:11 +09:00
|
|
|
use Illuminate\Support\Facades\Mail;
|
2021-10-28 17:12:12 +09:00
|
|
|
use Illuminate\Support\Facades\Storage;
|
2021-09-28 14:38:41 +09:00
|
|
|
|
2021-09-30 13:20:54 +09:00
|
|
|
use App\Models\Father;
|
|
|
|
use App\Models\FatherRelation;
|
2021-10-21 10:38:11 +09:00
|
|
|
use App\Models\EmailActivation;
|
|
|
|
use App\Mail\FathersRegistrationTemporaryMail;
|
|
|
|
use App\Mail\FathersRegistrationMainMail;
|
2021-09-28 14:38:41 +09:00
|
|
|
|
2021-09-30 13:20:54 +09:00
|
|
|
class FathersController extends Controller {
|
2021-10-25 20:16:43 +09:00
|
|
|
use AuthenticationTrait;
|
|
|
|
use AuthorizationTrait;
|
2021-10-21 11:46:10 +09:00
|
|
|
|
2021-10-25 20:16:43 +09:00
|
|
|
/* Traitで使うメソッド */
|
|
|
|
protected function getGuard () {
|
2021-10-30 23:13:12 +09:00
|
|
|
return 'fathers';
|
2021-10-21 19:47:39 +09:00
|
|
|
}
|
2021-10-25 20:16:43 +09:00
|
|
|
protected function getModel () {
|
2021-10-25 22:38:06 +09:00
|
|
|
return new \App\Models\Father();
|
2021-10-21 11:46:10 +09:00
|
|
|
}
|
2021-09-30 13:33:23 +09:00
|
|
|
|
2021-10-29 10:36:05 +09:00
|
|
|
public function requestPassword (Request $r) {
|
|
|
|
$validate = Validator::make($r->all(), [
|
|
|
|
'email' => 'required|max:255|email'
|
|
|
|
]);
|
|
|
|
|
|
|
|
if ($validate->fails()) {
|
|
|
|
// バリデーションエラー
|
|
|
|
return ['status_code' => 422, 'error_messages' => $validate->errors()];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($result = Father::select('id')->where('email', $r->email)->first()) {
|
|
|
|
// メールアドレス照合に失敗
|
|
|
|
return ['status_code' => 400, 'error_messages' => ['メールアドレスが未登録です。入力した情報を確認してください。']];
|
|
|
|
}
|
|
|
|
|
|
|
|
$token = bin2hex(random_bytes(16));
|
|
|
|
$create = [
|
|
|
|
'type' => 1,
|
|
|
|
'father_id' => $result->id,
|
|
|
|
'email' => $r->email,
|
|
|
|
'token' => $token,
|
|
|
|
'ttl' => date('Y-m-d H:i:s', time()+28800)
|
|
|
|
];
|
|
|
|
|
|
|
|
try {
|
|
|
|
// DBに入ります。
|
|
|
|
EmailActivation::create($create);
|
|
|
|
|
|
|
|
// メールを送ります。
|
|
|
|
Mail::to($r->email)->send(new FathersRegistrationTemporaryMail($token));
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
// 失敗
|
|
|
|
Log::critical($e->getMessage());
|
|
|
|
return ['status_code' => 400, 'error_messages' => 'メールアドレスが未登録です。入力した情報を確認してください。'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$params = [
|
|
|
|
'id' => $result->id,
|
|
|
|
'email' => $r->email,
|
|
|
|
];
|
|
|
|
|
|
|
|
// メールアドレス照合に成功
|
|
|
|
return ['status_code' => 200, 'params' => $params, 'success_messages' => ['再発行用パスワードの送信に成功しました。']];
|
|
|
|
}
|
2021-09-30 13:33:23 +09:00
|
|
|
|
2021-10-15 10:37:47 +09:00
|
|
|
public function registerTemporary (Request $r) {
|
|
|
|
$validate = Validator::make($r->all(), [
|
2021-10-21 10:38:11 +09:00
|
|
|
'email' => 'required|unique:fathers|unique:email_activations|max:255|email'
|
2021-10-15 10:37:47 +09:00
|
|
|
]);
|
|
|
|
|
|
|
|
if ($validate->fails()) {
|
|
|
|
// バリデーションエラー
|
|
|
|
return ['status_code' => 422, 'error_messages' => $validate->errors()];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($get = Father::where('email', $r->email)->first()) {
|
2021-10-21 10:38:11 +09:00
|
|
|
// すでにfathersに登録されている場合
|
2021-10-15 10:37:47 +09:00
|
|
|
return ['status_code' => 400, 'error_messages' => ['入力したメールアドレスは既に登録済みです。同じメールアドレスは使用できません。']];
|
|
|
|
}
|
2021-10-21 10:38:11 +09:00
|
|
|
else if ($get = EmailActivation::where('email', $r->email)->first()) {
|
|
|
|
// すでにemail_activationsに登録されている場合
|
2021-10-15 10:37:47 +09:00
|
|
|
return ['status_code' => 400, 'error_messages' => ['入力したメールアドレスは既に登録済みです。同じメールアドレスは使用できません。']];
|
|
|
|
}
|
|
|
|
else {
|
2021-10-21 19:07:32 +09:00
|
|
|
$token = bin2hex(random_bytes(16));
|
2021-10-15 10:37:47 +09:00
|
|
|
$create = ['email' => $r->email, 'token' => $token, 'ttl' => date('Y-m-d H:i:s', time()+28800)];
|
|
|
|
|
|
|
|
try {
|
2021-10-21 10:38:11 +09:00
|
|
|
// DBに入ります。
|
|
|
|
EmailActivation::create($create);
|
|
|
|
|
|
|
|
// メールを送ります。
|
|
|
|
Mail::to($r->email)->send(new FathersRegistrationTemporaryMail($token));
|
2021-10-15 10:37:47 +09:00
|
|
|
} catch (\Throwable $e) {
|
|
|
|
// 失敗
|
|
|
|
Log::critical($e->getMessage());
|
|
|
|
return ['status_code' => 400, 'error_messages' => '登録に失敗しました。'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 仮登録に成功した場合
|
|
|
|
return ['status_code' => 200, 'token' => $token, 'success_messages' => ['親の仮登録に成功しました。8時間以内に本登録を完了させてください。']];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function registerMain (Request $r) {
|
|
|
|
$validate = Validator::make($r->all(), [
|
|
|
|
'token' => 'required',
|
|
|
|
'password' => 'required|min:8|max:72|confirmed',
|
|
|
|
'company' => 'max:100',
|
|
|
|
'image' => 'max:1024|mimes:jpg,png,gif',
|
|
|
|
'profile' => 'max:1000',
|
2021-10-28 17:12:12 +09:00
|
|
|
'tel' => 'required|unique:children|numeric|digits_between:0,99999999999|starts_with:0',
|
2021-10-15 10:37:47 +09:00
|
|
|
]);
|
|
|
|
if ($validate->fails()) {
|
|
|
|
// バリデーションエラー
|
|
|
|
return ['status_code' => 422, 'error_messages' => $validate->errors()];
|
|
|
|
}
|
|
|
|
|
2021-10-21 11:07:16 +09:00
|
|
|
if ($get = EmailActivation::select('email', 'ttl')->where('token', $r->token)->first()) {
|
|
|
|
if (time() > strtotime($get->ttl)) {
|
|
|
|
// 有効期限が切れている場合
|
|
|
|
return['status_code' => 401, 'error_messages' => ['仮登録の有効期限が切れました。改めて管理者にお問い合わせいただき、再登録を行ってください。']];
|
|
|
|
}
|
2021-10-15 10:37:47 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2021-10-21 11:07:16 +09:00
|
|
|
// DBの値の準備。
|
2021-10-15 10:37:47 +09:00
|
|
|
$create = [
|
|
|
|
'email' => $get->email,
|
2021-10-21 11:07:16 +09:00
|
|
|
'password' => Hash::make($r->password),
|
2021-10-15 10:37:47 +09:00
|
|
|
'company' => $r->company,
|
|
|
|
'image' => $r->image,
|
|
|
|
'profile' => $r->profile,
|
|
|
|
'tel' => $r->tel,
|
|
|
|
];
|
|
|
|
|
2021-10-21 11:07:16 +09:00
|
|
|
// DBに入ります。
|
2021-10-15 10:37:47 +09:00
|
|
|
Father::create($create);
|
2021-10-21 11:07:16 +09:00
|
|
|
|
|
|
|
// メールを送ります。
|
|
|
|
Mail::to($get->email)->send(new FathersRegistrationMainMail());
|
|
|
|
|
|
|
|
// email_activationsから削除します。
|
|
|
|
EmailActivation::where('token', $r->token)->delete();
|
2021-10-15 10:37:47 +09:00
|
|
|
} catch (\Throwable $e) {
|
|
|
|
// 本登録に失敗
|
|
|
|
Log::critical($e->getMessage());
|
|
|
|
return ['status_code' => 400, 'error_messages' => ['本登録に失敗しました。']];
|
|
|
|
}
|
|
|
|
|
|
|
|
// 本登録に成功
|
|
|
|
return ['status_code' => 200];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function search (Request $r) {
|
|
|
|
if (!isset($r->keyword)) {
|
|
|
|
return ['status_code' => 400];
|
|
|
|
}
|
|
|
|
|
|
|
|
$result = [];
|
2021-10-24 02:20:26 +09:00
|
|
|
$father_select = ['id', 'company', 'image', 'email'];
|
2021-10-15 10:37:47 +09:00
|
|
|
$father_relation_select = ['created_at'];
|
|
|
|
|
2021-10-24 02:20:26 +09:00
|
|
|
if (null === ($result = Father::select($father_select)->where('company', 'LIKE', '%'.$r->keyword.'%')->orderBy('created_at', 'desc')->get())) {
|
2021-10-15 10:37:47 +09:00
|
|
|
// 親一覧の取得に失敗
|
|
|
|
return ['status_code' => 400];
|
|
|
|
}
|
|
|
|
|
2021-10-24 02:20:26 +09:00
|
|
|
// foreach ($list as $i => $l) {
|
|
|
|
// $result[] = $l;
|
|
|
|
// if (null === ($result[$i]['relation'] = FatherRelation::select($father_relation_select)->where('father_id', $l->id)->first())) {
|
|
|
|
// return ['status_code' => 400];
|
|
|
|
// }
|
|
|
|
// }
|
2021-10-15 10:37:47 +09:00
|
|
|
|
|
|
|
// 親一覧の取得に成功
|
|
|
|
return ['status_code' => 200, 'params' => $result];
|
|
|
|
}
|
2021-09-30 13:33:23 +09:00
|
|
|
|
2021-10-06 14:50:13 +09:00
|
|
|
public function list () {
|
|
|
|
$result = [];
|
2021-10-24 02:20:26 +09:00
|
|
|
$father_select = ['id', 'company', 'image', 'email'];
|
2021-10-06 14:50:13 +09:00
|
|
|
$father_relation_select = ['created_at'];
|
2021-09-30 13:20:54 +09:00
|
|
|
|
2021-10-24 02:20:26 +09:00
|
|
|
if (null === ($result = Father::select($father_select)->orderBy('created_at', 'desc')->get())) {
|
2021-10-07 13:51:53 +09:00
|
|
|
// 親一覧の取得に失敗
|
|
|
|
return ['status_code' => 400];
|
|
|
|
}
|
2021-09-30 13:20:54 +09:00
|
|
|
|
2021-10-28 17:12:12 +09:00
|
|
|
// foreach ($list as $i => $l) {
|
|
|
|
// $result[] = $l;
|
|
|
|
// if (null === ($result[$i]['relation'] = FatherRelation::select($father_relation_select)->where('father_id', $l->id)->first())) {
|
|
|
|
// continue;
|
|
|
|
// }
|
|
|
|
// }
|
2021-10-06 14:50:13 +09:00
|
|
|
|
2021-10-07 13:51:53 +09:00
|
|
|
// 親一覧の取得に成功
|
|
|
|
return ['status_code' => 200, 'params' => $result];
|
2021-09-30 13:20:54 +09:00
|
|
|
}
|
|
|
|
|
2021-10-06 14:50:13 +09:00
|
|
|
public function listOfChild (Request $r) {
|
|
|
|
$result = [];
|
|
|
|
$father_select = ['id', 'company', 'image'];
|
2021-09-30 13:20:54 +09:00
|
|
|
|
2021-10-25 20:16:43 +09:00
|
|
|
if (null === ($list = FatherRelation::select('father_id')->where('child_id', (int)$r->child_id)->orderBy('created_at', 'desc')->get())) {
|
2021-10-07 13:51:53 +09:00
|
|
|
// 親一覧の取得に失敗
|
|
|
|
return ['status_code' => 400];
|
|
|
|
}
|
2021-09-30 13:20:54 +09:00
|
|
|
|
2021-10-07 13:51:53 +09:00
|
|
|
foreach ($list as $l) {
|
|
|
|
if (null === ($result[] = Father::select($father_select)->find($l->father_id))) {
|
|
|
|
return ['status_code' => 400];
|
2021-10-06 14:50:13 +09:00
|
|
|
}
|
|
|
|
}
|
2021-09-30 13:20:54 +09:00
|
|
|
|
2021-10-07 13:51:53 +09:00
|
|
|
// 親一覧の取得に成功
|
|
|
|
return ['status_code' => 200, 'params' => $result];
|
2021-09-30 13:20:54 +09:00
|
|
|
}
|
2021-09-28 14:38:41 +09:00
|
|
|
|
2021-10-06 14:50:13 +09:00
|
|
|
public function detail ($father_id) {
|
2021-10-15 10:37:47 +09:00
|
|
|
$father_select = ['image', 'email', 'tel', 'profile', 'company'];
|
2021-09-30 13:22:41 +09:00
|
|
|
|
2021-10-29 21:46:55 +09:00
|
|
|
if (null === ($result = Father::select($father_select)->where('id', (int)$father_id)->orderBy('created_at', 'desc')->first())) {
|
2021-10-07 13:51:53 +09:00
|
|
|
// 親詳細の取得に失敗
|
2021-10-15 10:37:47 +09:00
|
|
|
return ['status_code' => 400, 'error_messages' => ['親の更新に失敗しました。']];
|
2021-10-06 14:50:13 +09:00
|
|
|
}
|
2021-09-30 13:22:41 +09:00
|
|
|
|
2021-10-07 13:51:53 +09:00
|
|
|
// 親詳細の取得に成功
|
|
|
|
return ['status_code' => 200, 'params' => $result];
|
2021-09-30 13:22:41 +09:00
|
|
|
}
|
|
|
|
|
2021-10-06 14:50:13 +09:00
|
|
|
public function updateImage (Request $r, $father_id) {
|
|
|
|
if (!isset($r->image) || !isset($father_id)) {
|
2021-10-15 10:37:47 +09:00
|
|
|
return ['status_code' => 400, 'error_messages' => ['親の更新に失敗しました。']];
|
2021-10-06 14:50:13 +09:00
|
|
|
}
|
|
|
|
|
2021-10-28 17:12:12 +09:00
|
|
|
// ファイルサイズは10MiB以内
|
|
|
|
Validator::extend('image_size', function ($attribute, $value, $params, $validator) {
|
|
|
|
try {
|
|
|
|
return strlen(base64_decode($value)) < 1048576;
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
Log::critical($e->getMessage());
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// ミームタイプ
|
|
|
|
Validator::extend('image_meme', function ($attribute, $value, $params, $validator) {
|
|
|
|
try {
|
|
|
|
return (
|
|
|
|
mime_content_type($value) == 'image/jpeg' || // jpg
|
|
|
|
mime_content_type($value) == 'image/png' || // png
|
|
|
|
mime_content_type($value) == 'image/gif' // gif
|
|
|
|
);
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
Log::critical($e->getMessage());
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-10-06 14:50:13 +09:00
|
|
|
// バリデーションエラー
|
2021-10-28 17:12:12 +09:00
|
|
|
$validate = Validator::make($r->all(), ['image' => 'image_size|image_meme']);
|
2021-10-06 14:50:13 +09:00
|
|
|
// 300x300px
|
|
|
|
|
|
|
|
if ($validate->fails()) {
|
|
|
|
return ['status_code' => 422, 'error_messages' => $validate->errors()];
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2021-10-28 17:12:12 +09:00
|
|
|
$ext = explode('/', mime_content_type($r->image))[1];
|
|
|
|
$filename = uniqid() . '.'.$ext;
|
|
|
|
$image = base64_decode(substr($r->image, strpos($r->image, ',') + 1));
|
|
|
|
Storage::disk('public')->put($filename, $image);
|
|
|
|
|
|
|
|
$update = [
|
|
|
|
'image' => '/storage/'.$filename
|
|
|
|
];
|
|
|
|
|
2021-10-25 20:16:43 +09:00
|
|
|
Father::where('id', (int)$father_id)->update($update);
|
2021-10-06 14:50:13 +09:00
|
|
|
} catch (\Throwable $e) {
|
|
|
|
// 親プロフィール画像のアップロードに失敗
|
|
|
|
Log::critical($e->getMessage());
|
2021-10-15 10:37:47 +09:00
|
|
|
return ['status_code' => 400, 'error_messages' => ['親の更新に失敗しました。']];
|
2021-10-06 14:50:13 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
// 親プロフィール画像のアップロードに成功
|
2021-10-15 10:37:47 +09:00
|
|
|
return ['status_code' => 200, 'success_messages' => ['親の更新に成功しました。']];
|
2021-10-06 14:50:13 +09:00
|
|
|
}
|
2021-09-30 13:22:41 +09:00
|
|
|
|
2021-10-06 14:50:13 +09:00
|
|
|
public function updateProfile (Request $r, $father_id) {
|
|
|
|
if (!isset($father_id)) {
|
2021-10-15 10:37:47 +09:00
|
|
|
return ['status_code' => 400, 'error_messages' => ['親の更新に失敗しました。']];
|
2021-10-06 14:50:13 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
// バリデーションエラー
|
|
|
|
$validate = Validator::make($r->all(), [
|
2021-10-25 20:16:43 +09:00
|
|
|
'email' => 'required|max:255|email',
|
2021-10-06 14:50:13 +09:00
|
|
|
'company' => 'max:100',
|
|
|
|
'profile' => 'max:1000',
|
2021-10-28 17:12:12 +09:00
|
|
|
'tel' => 'required|numeric|digits_between:0,99999999999|starts_with:0',
|
2021-10-06 14:50:13 +09:00
|
|
|
]);
|
|
|
|
|
|
|
|
if ($validate->fails()) {
|
|
|
|
return ['status_code' => 422, 'error_messages' => $validate->errors()];
|
|
|
|
}
|
|
|
|
|
2021-10-25 20:16:43 +09:00
|
|
|
$update = [
|
|
|
|
'email' => $r->email,
|
|
|
|
'company' => $r->company,
|
|
|
|
'profile' => $r->profile,
|
|
|
|
'tel' => $r->tel,
|
|
|
|
];
|
|
|
|
|
2021-10-06 14:50:13 +09:00
|
|
|
try {
|
2021-10-25 20:16:43 +09:00
|
|
|
Father::where('id', (int)$father_id)->update($update);
|
2021-10-06 14:50:13 +09:00
|
|
|
} catch (\Throwable $e) {
|
|
|
|
// 親プロフィール更新失敗
|
|
|
|
Log::critical($e->getMessage());
|
2021-10-15 10:37:47 +09:00
|
|
|
return ['status_code' => 400, 'error_messages' => ['親の更新に失敗しました。']];
|
2021-10-06 14:50:13 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
// 親プロフィール更新成功
|
2021-10-15 10:37:47 +09:00
|
|
|
return ['status_code' => 200, 'success_messages' => ['親の更新に成功しました。']];
|
2021-10-06 14:50:13 +09:00
|
|
|
}
|
2021-09-30 13:33:23 +09:00
|
|
|
|
2021-10-06 14:50:13 +09:00
|
|
|
public function updatePassword (Request $r, $father_id) {
|
2021-10-24 04:08:44 +09:00
|
|
|
if (!isset($father_id)) {
|
2021-10-15 10:37:47 +09:00
|
|
|
return ['status_code' => 400, 'error_messages' => ['親の更新に失敗しました。']];
|
2021-10-06 14:50:13 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
// バリデーションエラー
|
|
|
|
$validate = Validator::make($r->all(), [
|
|
|
|
'password' => 'required|min:8|max:72|confirmed',
|
|
|
|
]);
|
|
|
|
|
|
|
|
if ($validate->fails()) {
|
|
|
|
return ['status_code' => 422, 'error_messages' => $validate->errors()];
|
|
|
|
}
|
|
|
|
|
2021-10-25 20:16:43 +09:00
|
|
|
$update = [
|
|
|
|
'password' => Hash::make($r->password)
|
|
|
|
];
|
|
|
|
|
2021-10-06 14:50:13 +09:00
|
|
|
try {
|
2021-10-25 20:16:43 +09:00
|
|
|
Father::where('id', (int)$father_id)->update($update);
|
2021-10-06 14:50:13 +09:00
|
|
|
} catch (\Throwable $e) {
|
|
|
|
// 失敗
|
|
|
|
Log::critical($e->getMessage());
|
2021-10-15 10:37:47 +09:00
|
|
|
return ['status_code' => 400, 'error_messages' => ['親の更新に失敗しました。']];
|
2021-10-06 14:50:13 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
// 成功
|
2021-10-15 10:37:47 +09:00
|
|
|
return ['status_code' => 200, 'success_messages' => ['親の更新に成功しました。']];
|
2021-10-06 14:50:13 +09:00
|
|
|
}
|
2021-09-30 13:33:23 +09:00
|
|
|
|
2021-10-29 22:19:12 +09:00
|
|
|
public function withdrawal (Request $r) {
|
2021-10-07 13:51:53 +09:00
|
|
|
try {
|
2021-10-29 22:19:12 +09:00
|
|
|
Father::where('id', (int)$r->father_id)->delete();
|
2021-10-07 13:51:53 +09:00
|
|
|
} catch (\Throwable $e) {
|
|
|
|
// 失敗
|
|
|
|
Log::critical($e->getMessage());
|
|
|
|
return ['status_code' => 400, 'error_messages' => ['親の削除に失敗しました。']];
|
2021-10-06 14:50:13 +09:00
|
|
|
}
|
2021-10-07 13:51:53 +09:00
|
|
|
|
|
|
|
// 成功
|
|
|
|
return ['status_code' => 200, 'success_messages' => ['親の削除に成功しました。']];
|
2021-09-30 13:22:41 +09:00
|
|
|
}
|
|
|
|
|
2021-10-29 22:19:12 +09:00
|
|
|
public function delete ($father_id) {
|
2021-10-07 13:51:53 +09:00
|
|
|
try {
|
2021-10-29 22:19:12 +09:00
|
|
|
Father::where('id', (int)$father_id)->delete();
|
2021-10-07 13:51:53 +09:00
|
|
|
} catch (\Throwable $e) {
|
|
|
|
// 失敗
|
|
|
|
Log::critical($e->getMessage());
|
2021-10-15 10:37:47 +09:00
|
|
|
return ['status_code' => 400, 'error_messages' => ['親の削除に失敗しました。']];
|
2021-10-06 14:50:13 +09:00
|
|
|
}
|
2021-10-07 13:51:53 +09:00
|
|
|
|
|
|
|
// 成功
|
2021-10-15 10:37:47 +09:00
|
|
|
return ['status_code' => 200, 'success_messages' => ['親の削除に成功しました。']];
|
2021-10-06 14:50:13 +09:00
|
|
|
}
|
2021-09-28 14:38:41 +09:00
|
|
|
}
|