プロフィール設定の実装
This commit is contained in:
parent
5d256519c6
commit
85cc865545
@ -13,9 +13,24 @@ class SettingController extends Controller
|
||||
return view('setting.profile');
|
||||
}
|
||||
|
||||
public function updateProfile()
|
||||
public function updateProfile(Request $request)
|
||||
{
|
||||
abort(501);
|
||||
$inputs = $request->all();
|
||||
$validator = Validator::make($inputs, [
|
||||
'display_name' => 'required|string|max:20'
|
||||
], [], [
|
||||
'display_name' => '名前'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('setting')->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
$user = Auth::user();
|
||||
$user->display_name = $inputs['display_name'];
|
||||
$user->save();
|
||||
|
||||
return redirect()->route('setting')->with('status', 'プロフィールを更新しました。');
|
||||
}
|
||||
|
||||
public function updatePrivacy(Request $request)
|
||||
|
@ -9,7 +9,12 @@
|
||||
{{ csrf_field() }}
|
||||
<div class="from-group">
|
||||
<label for="display_name">名前</label>
|
||||
<input id="display_name" name="display_name" type="text" class="form-control" value="{{ old('display_name') ?? Auth::user()->display_name }}">
|
||||
<input id="display_name" name="display_name" type="text" class="form-control {{ $errors->has('display_name') ? ' is-invalid' : '' }}"
|
||||
value="{{ old('display_name') ?? Auth::user()->display_name }}" maxlength="20" autocomplete="off">
|
||||
|
||||
@if ($errors->has('display_name'))
|
||||
<div class="invalid-feedback">{{ $errors->first('display_name') }}</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="from-group mt-2">
|
||||
<label for="name">ユーザー名</label>
|
||||
|
Loading…
Reference in New Issue
Block a user