MacieG

Laravel - Array to string conversion - When validation failed

Posted 1 year 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.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.