From 41e810c788dfbbc39b7e7fc6824286e48c3c1b35 Mon Sep 17 00:00:00 2001 From: shibafu Date: Thu, 7 Feb 2019 00:27:43 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=97=E3=83=AD=E3=83=95=E3=82=A3=E3=83=BC?= =?UTF-8?q?=E3=83=AB=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2=E3=81=AB=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E7=B4=B9=E4=BB=8B=E3=81=A8URL=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/SettingController.php | 10 ++++++++-- resources/views/setting/profile.blade.php | 20 +++++++++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php index 1f812e3..136f055 100644 --- a/app/Http/Controllers/SettingController.php +++ b/app/Http/Controllers/SettingController.php @@ -17,9 +17,13 @@ class SettingController extends Controller { $inputs = $request->all(); $validator = Validator::make($inputs, [ - 'display_name' => 'required|string|max:20' + 'display_name' => 'required|string|max:20', + 'bio' => 'nullable|string|max:160', + 'url' => 'nullable|url|max:2000' ], [], [ - 'display_name' => '名前' + 'display_name' => '名前', + 'bio' => '自己紹介', + 'url' => 'URL' ]); if ($validator->fails()) { @@ -28,6 +32,8 @@ class SettingController extends Controller $user = Auth::user(); $user->display_name = $inputs['display_name']; + $user->bio = $inputs['bio'] ?? ''; + $user->url = $inputs['url'] ?? ''; $user->save(); return redirect()->route('setting')->with('status', 'プロフィールを更新しました。'); diff --git a/resources/views/setting/profile.blade.php b/resources/views/setting/profile.blade.php index 4bbe86a..92df931 100644 --- a/resources/views/setting/profile.blade.php +++ b/resources/views/setting/profile.blade.php @@ -16,7 +16,7 @@
{{ $errors->first('display_name') }}
@endif -
+
@@ -26,6 +26,24 @@
現在は変更できません。
+
+ + + 最大 160 文字 + + @if ($errors->has('bio')) +
{{ $errors->first('bio') }}
+ @endif +
+
+ + + + @if ($errors->has('url')) +
{{ $errors->first('url') }}
+ @endif +