lundi 1 avril 2019

data not saving to db, but no errors - laravel 5.8

I tried the following code, but the data was not getting saved to the DB , and no error showed up. It properly redirected to the tags.index page and the success message also displayed, except data getting saved to DB.

But simply changing the $tags to $tag, it started working and the data is getting saved to DB. Can someone explain what the problem was.

public function update(CreateTagRequest $request, Tags $tags)
    {
        //dd($request->name);
        $tags->update([
            'name' => $request->name
        ]);

        return redirect(route('tags.index'))->with('success','Tag Updated Successfully');
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire