laravel validation does not work with Auth

I am trying to add validation in the controller but it does not work with auth:check. This is the Laravel version 5.7.

This is the function store that has a problem with the validation.

 public function store(Request $request)
{
$request->validate([
'first_name' => ['required'|'min:2'|'max:50']
]);

if(Auth::check()){

$player = Player::create([
'first_name' => $request->input('fist_name'),
'last_name' => $request->input('last_name'),
]);


if($player){
return redirect()->route('players.show', ['player'=> $player->id])
->with('success' , 'foo');
}

}

return back()->withInput()->with('errors', 'Foo Error');
}


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Ja0CDq
via IFTTT

تعليقات

المشاركات الشائعة من هذه المدونة

I am unable to figure out how to create payment collection request, after a form has been submitted in laravel

laravel, mysql transaction not working after failed one time