diff --git a/backend/.env.example b/backend/.env.example
index c1bd2118..340b207b 100644
--- a/backend/.env.example
+++ b/backend/.env.example
@@ -1,4 +1,4 @@
-APP_NAME=Laravel
+APP_NAME=KIKIkan
APP_ENV=local
APP_KEY=
APP_DEBUG=true
diff --git a/backend/.env.release b/backend/.env.release
index c1bd2118..340b207b 100644
--- a/backend/.env.release
+++ b/backend/.env.release
@@ -1,4 +1,4 @@
-APP_NAME=Laravel
+APP_NAME=KIKIkan
APP_ENV=local
APP_KEY=
APP_DEBUG=true
diff --git a/backend/app/Http/Controllers/Api/ChildrenController.php b/backend/app/Http/Controllers/Api/ChildrenController.php
index 5b19a259..71d6f88b 100644
--- a/backend/app/Http/Controllers/Api/ChildrenController.php
+++ b/backend/app/Http/Controllers/Api/ChildrenController.php
@@ -10,8 +10,6 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
-use Image;
-
use App\Models\Child;
use App\Models\FatherRelation;
use App\Models\MeetingApprovals;
@@ -159,11 +157,7 @@ class ChildrenController extends Controller {
if (!is_null($r->image)) {
$image = base64_decode(substr($r->image, strpos($r->image, ',') + 1));
Storage::disk('private')->put($filename, $image);
-
- $quality = 1;
- $img = Image::make('/work/storage/app/private/'.$filename)->encode('jpg', $quality);
- $img->orientate();
- $img->save('/work/storage/app/private/'.$filename);
+ $this->fiximg($filename);
}
$child->fill($insert);
@@ -419,11 +413,7 @@ class ChildrenController extends Controller {
$image = base64_decode(substr($r->image, strpos($r->image, ',') + 1));
Storage::disk('private')->put($filename, $image);
-
- $quality = 1;
- $img = Image::make('/work/storage/app/private/'.$filename)->encode('jpg', $quality);
- $img->orientate();
- $img->save('/work/storage/app/private/'.$filename);
+ $this->fiximg($filename);
$child = Child::find((int)$child_id);
if (!is_null($child->image) && $child->image != '/assets/default/avatar.jpg') {
diff --git a/backend/app/Http/Controllers/Api/FathersController.php b/backend/app/Http/Controllers/Api/FathersController.php
index f03b2ce3..6aab2cc3 100644
--- a/backend/app/Http/Controllers/Api/FathersController.php
+++ b/backend/app/Http/Controllers/Api/FathersController.php
@@ -11,11 +11,11 @@ use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
-use Image;
-
use App\Models\Father;
use App\Models\FatherRelation;
use App\Models\EmailActivation;
+use App\Models\Meeting;
+use App\Models\MeetingImage;
use App\Models\MeetingApprovals;
use App\Mail\FathersForgetPasswordMail;
@@ -156,7 +156,7 @@ class FathersController extends Controller {
$validate = Validator::make($r->all(), [
'token' => 'required',
'password' => 'required|min:8|max:72|confirmed',
- 'company' => 'max:100',
+ 'company' => 'required|max:100',
'image' => 'image_size|image_meme',
'profile' => 'max:1000',
'tel' => 'required|unique:fathers|numeric|starts_with:0|tel_size',
@@ -180,11 +180,7 @@ class FathersController extends Controller {
$filename = $this->uuidv4().'.jpg';
$image = base64_decode(substr($r->image, strpos($r->image, ',') + 1));
Storage::disk('private')->put($filename, $image);
-
- $quality = 1;
- $img = Image::make('/work/storage/app/private/'.$filename)->encode('jpg', $quality);
- $img->orientate();
- $img->save('/work/storage/app/private/'.$filename);
+ $this->fiximg($filename);
}
try {
@@ -354,11 +350,7 @@ class FathersController extends Controller {
$image = base64_decode(substr($r->image, strpos($r->image, ',') + 1));
Storage::disk('private')->put($filename, $image);
-
- $quality = 1;
- $img = Image::make('/work/storage/app/private/'.$filename)->encode('jpg', $quality);
- $img->orientate();
- $img->save('/work/storage/app/private/'.$filename);
+ $this->fiximg($filename);
$father = Father::find((int)$father_id);
if (!is_null($father->image) && $father->image != '/assets/default/avatar.jpg') {
@@ -517,13 +509,38 @@ class FathersController extends Controller {
}
public function withdrawal (Request $r) {
+ $images = [];
+ $pdfs = [];
+
try {
// DBに入ります。
DB::beginTransaction();
$father = Father::find((int)$r->father_id);
+ $rel = FatherRelation::where('father_id', (int)$r->father_id);
+ $meet = Meeting::where('father_id', (int)$r->father_id);
+
+ if ($meet->count() > 0) {
+ foreach ($meet->get() as $n) {
+ $meim = MeetingImage::where('meeting_id', (int)$n->id);
+ $oldpdf = str_replace('/files/', '', $n->pdf);
+ $pdfs[] = $oldpdf;
+
+ if ($meim->count() > 0) {
+ foreach ($meim->get() as $m) {
+ $oldimg = str_replace('/files/', '', $m->image);
+ $images[] = $oldimg;
+ }
+ }
+ }
+ }
+
$img = $father->image;
+
$father->delete();
+ $rel->delete();
+ $meet->delete();
+ $meim->delete();
if (!is_null($img)) {
$img = str_replace('/files/', '', $father->image);
@@ -535,39 +552,29 @@ class FathersController extends Controller {
}
}
- Session::forget($this->getGuard());
- DB::commit();
- } catch (\Throwable $e) {
- // 失敗
- Log::critical($e->getMessage());
- DB::rollback();
- return ['status_code' => 400, 'error_messages' => ['親の削除に失敗しました。']];
- }
-
- // 成功
- return ['status_code' => 200, 'success_messages' => ['親の削除に成功しました。']];
- }
-
- public function delete ($father_id) {
- try {
- // DBに入ります。
- DB::beginTransaction();
-
- $father = Father::find((int)$father_id);
- $img = $father->image;
- $father->delete();
-
- if (!is_null($img)) {
- $img = str_replace('/files/', '', $father->image);
- if (!Storage::disk('private')->exists($img)) {
- Log::warning($img.'というパスは不正です。');
- }
- else {
- Storage::disk('private')->delete($img);
+ if (!empty($pdfs)) {
+ foreach ($pdfs as $p) {
+ if (!Storage::disk('private')->exists($p)) {
+ Log::warning($p.'というパスは不正です。');
+ }
+ else {
+ Storage::disk('private')->delete($p);
+ }
}
}
- Session::forget($this->getGuard());
+ if (!empty($images)) {
+ foreach ($images as $g) {
+ if (!Storage::disk('private')->exists($g)) {
+ Log::warning($g.'というパスは不正です。');
+ }
+ else {
+ Storage::disk('private')->delete($g);
+ }
+ }
+ }
+
+ Session::forget('fathers');
DB::commit();
} catch (\Throwable $e) {
// 失敗
diff --git a/backend/app/Http/Controllers/Api/MeetingImagesController.php b/backend/app/Http/Controllers/Api/MeetingImagesController.php
index 150f72cf..c53cf46e 100644
--- a/backend/app/Http/Controllers/Api/MeetingImagesController.php
+++ b/backend/app/Http/Controllers/Api/MeetingImagesController.php
@@ -8,8 +8,6 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
-use Image;
-
use App\Models\MeetingImage;
class MeetingImagesController extends Controller {
@@ -52,10 +50,7 @@ class MeetingImagesController extends Controller {
$fname[] = $filename;
$image = base64_decode(substr($img, strpos($img, ',') + 1));
Storage::disk('private')->put($filename, $image);
- $quality = 1;
- $imag = Image::make('/work/storage/app/private/'.$filename)->encode('jpg', $quality);
- $img->orientate();
- $imag->save('/work/storage/app/private/'.$filename);
+ $this->fiximg($filename);
$insert = [
'meeting_id' => (int)$r->meeting_id,
diff --git a/backend/app/Http/Controllers/Api/MeetingsController.php b/backend/app/Http/Controllers/Api/MeetingsController.php
index 5572025a..2e35a9ab 100644
--- a/backend/app/Http/Controllers/Api/MeetingsController.php
+++ b/backend/app/Http/Controllers/Api/MeetingsController.php
@@ -9,8 +9,6 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
-use Image;
-
use App\Models\Meeting;
use App\Models\MeetingImage;
use App\Models\MeetingApprovals;
@@ -122,10 +120,7 @@ class MeetingsController extends Controller {
$fnames[] = $fname;
$image = base64_decode(substr($img, strpos($img, ',') + 1));
Storage::disk('private')->put($fname, $image);
- $quality = 1;
- $imag = Image::make('/work/storage/app/private/'.$fname)->encode('jpg', $quality);
- $imag->orientate();
- $imag->save('/work/storage/app/private/'.$fname);
+ $this->fiximg($filename);
$imgname = '/files/'.$fname;
diff --git a/backend/app/Http/Controllers/Controller.php b/backend/app/Http/Controllers/Controller.php
index 434ced1a..55059246 100644
--- a/backend/app/Http/Controllers/Controller.php
+++ b/backend/app/Http/Controllers/Controller.php
@@ -7,6 +7,7 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Log;
+use Image;
class Controller extends BaseController
{
@@ -160,4 +161,24 @@ class Controller extends BaseController
return false;
}
}
+
+ public function fiximg ($filename, $quality=1) {
+ $img = Image::make('/work/storage/app/private/'.$filename)->encode('jpg', $quality);
+ $img->orientate();
+ if ($img->width() < $img->height() && $img->width() > 400) {
+ $img->resize(400, null, function ($constraint) {
+ $constraint->aspectRatio();
+ $constraint->upsize();
+ });
+ }
+ else if ($img->height() < $img->width() && $img->height() > 400) {
+ $img->resize(400, null, function ($constraint) {
+ $constraint->aspectRatio();
+ $constraint->upsize();
+ });
+ }
+ $img->save('/work/storage/app/private/'.$filename);
+
+ return $filename;
+ }
}
diff --git a/backend/resources/views/emails/fathers/registration/temporary.blade.php b/backend/resources/views/emails/fathers/registration/temporary.blade.php
index 8f33c9d9..0d1b0827 100644
--- a/backend/resources/views/emails/fathers/registration/temporary.blade.php
+++ b/backend/resources/views/emails/fathers/registration/temporary.blade.php
@@ -5,25 +5,25 @@ KIKIkanサービスの会員登録のご案内です。
KIKIkanシステムのご利用ありがとうございます。
-※本登録完了後にホーム画面もしくはブックマークに登録してください。
+※本登録完了後にホーム画面もしくはブックマークに登録してください。
ログインする際に利用します。
-下記URLにアクセスし、必要情報をご入力頂き
+下記URLにアクセスし、必要情報をご入力頂き
ユーザー登録を完了してください。
@component('mail::button', ['url' => url('/').'/p-account/register/'.$token])
{{ url('/') }}/p-account/register/{{ $token }}
@endcomponent
-なお、URLの有効期限は8時間となります。
+なお、URLの有効期限は8時間となります。
URLの有効期限を過ぎると、再登録が必要になりますので、ご注意ください。
※このメールに心当たりがない場合は下記のメールにご連絡ください。
■□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□■
-KIKIkan運営事務局
-56@zotman.jp
+KIKIkan運営事務局
+56@zotman.jp
{{ url('/') }}/
■□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□■
diff --git a/backend/resources/views/vendor/mail/html/header.blade.php b/backend/resources/views/vendor/mail/html/header.blade.php
index b5882239..ed61a133 100755
--- a/backend/resources/views/vendor/mail/html/header.blade.php
+++ b/backend/resources/views/vendor/mail/html/header.blade.php
@@ -1,11 +1,7 @@