fix: user can update bio info
This commit is contained in:
@@ -7,6 +7,9 @@ use App\Models\Artwork;
|
||||
use App\Models\Podcast;
|
||||
use App\Models\Episode;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class ArtistController extends Controller
|
||||
{
|
||||
@@ -97,7 +100,28 @@ class ArtistController extends Controller
|
||||
*/
|
||||
public function update(Request $request, Artist $artist)
|
||||
{
|
||||
//
|
||||
$user = auth()->user();
|
||||
$artist = $user->artists->first();
|
||||
$rules = [
|
||||
'location' => ['string', 'max:255'],
|
||||
'alby' => ['email'],
|
||||
'website' => ['url'],
|
||||
'nasocial' => ['starts_with:@'],
|
||||
];
|
||||
$validator = Validator::make($request->all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return back()
|
||||
->withErrors($validator)
|
||||
->withInput();
|
||||
}
|
||||
$artist->location = $request->location;
|
||||
$artist->alby = $request->alby;
|
||||
$artist->website = $request->website;
|
||||
$artist->nasocial = $request->nasocial;
|
||||
if ($artist->isDirty()) {
|
||||
$artist->save();
|
||||
}
|
||||
return redirect('/profile');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,6 +29,8 @@ class Artist extends Model
|
||||
'avatar',
|
||||
'header',
|
||||
'location',
|
||||
'alby',
|
||||
'naasocial',
|
||||
'website',
|
||||
'bio',
|
||||
'created_at',
|
||||
|
||||
Reference in New Issue
Block a user