MacieG
252
9
Laravel

Laravel - Array to string conversion - When validation failed

Posted 2 years ago by MacieG

I do not know why but still something breaks... Now...

Array to string conversion

When validation = true all is good, but when is false i have this errror

public function store(ChangeUserDataRequest $request){
        $user = auth()->user();
        $user->first_name = $request['first_name'];
        $user->save();
        return response()->json(["message" =>true]);
    }

//ChangeUserDataRequest

public function rules()
    {
        return [
            'first_name' => 'required|min:3|max:15',
        ];
    }

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.