Laravel-5.6 Error: Creating default object from empty value

Posted 9 months ago by shamsul_huda

when I'm trying to update value, it shows this error. How can i solve this problem? Here is the simple code....

 public function update(Request $request, $id)
    {
        $this->validate($request, [
            'tag' => 'required'
        ]);
 
        $tag = Tag::find($id);
 
        $tag->tag = $request->tag;
 
        $tag->save();
 
        Session::flash('success', 'Tag Updated Successfully.');
 
        return redirect()->route('tags');
    }

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