fix: allowing users to change artist display name.

This commit is contained in:
Paul Couture 2023-12-21 15:31:06 -06:00
parent c46664492d
commit bf30235e1d
2 changed files with 7 additions and 0 deletions

View File

@ -107,6 +107,7 @@ public function update(Request $request, Artist $artist)
'alby' => ['email'], 'alby' => ['email'],
'website' => ['url'], 'website' => ['url'],
'nasocial' => ['starts_with:@'], 'nasocial' => ['starts_with:@'],
'name' => ['string', 'unique:artists', 'max:255'],
]; ];
$validator = Validator::make($request->all(), $rules); $validator = Validator::make($request->all(), $rules);
if ($validator->fails()) { if ($validator->fails()) {
@ -118,6 +119,7 @@ public function update(Request $request, Artist $artist)
$artist->alby = $request->alby; $artist->alby = $request->alby;
$artist->website = $request->website; $artist->website = $request->website;
$artist->nasocial = $request->nasocial; $artist->nasocial = $request->nasocial;
$artist->name = $request->name;
if ($artist->isDirty()) { if ($artist->isDirty()) {
$artist->save(); $artist->save();
} }

View File

@ -13,6 +13,11 @@
<div class="col"> <div class="col">
<form method="post" action="/update-profile"> <form method="post" action="/update-profile">
@csrf @csrf
<div>
<x-input-label for="name" :value="__('Display Name')" />
<x-text-input id="name" name="name" type="text" class="mt-1 block w-full" :value="old('name', $user->artists->first()->name)" required autocomplete="name" />
<x-input-error class="mt-2" :messages="$errors->get('name')" />
</div>
<div> <div>
<x-input-label for="location" :value="__('Location')" /> <x-input-label for="location" :value="__('Location')" />
<x-text-input id="location" name="location" type="text" class="mt-1 block w-full" :value="old('location', $user->artists->first()->location)" required autocomplete="location" /> <x-text-input id="location" name="location" type="text" class="mt-1 block w-full" :value="old('location', $user->artists->first()->location)" required autocomplete="location" />