LetMeKnow
1 month ago
190
1
Laravel

Argument 1 passed to Illuminate\Database\Eloquent\Builder::update() must be of the type array,

Posted 1 month ago by LetMeKnow

I hava error when im edit my TagsController.php , and error is

Argument 1 passed to Illuminate\Database\Eloquent\Builder::update() must be of the type array, string given, called in /web/app/Http/Controllers/TagsController.php on line 89

my controller is

 $this->validate($request, [
            'name' => 'required|max:20|min:3'
        ]);
            $tags_data = [
                'name' => $request->name,
                'slug' => Str::slug($request->name)
            ];
            Tags::whereId($id)->update('tags_data');

            return rediect()->route('tag.index')->with('Berhasil','Tag Sudah berhasil diupdate');

line 89 is

Tags::whereId($id)->update('tags_data');

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