Advertisement

TrimwebsolutionsTrimwebsolutions

Problem and Solutions

where could i be wrong? Trying to get property 'title' of non-object in laravel

By M.K. Verma · 2 May 2022

where could i be wrong? Trying to get property 'title' of non-object in laravel
public function theblog(Request $req, $slug){ $blog = blog::find($slug);
dd($slug); 
 DB::table("blogs")->where('slug', "$slug")->increment('views'); return view('myblog',compact('blog')); } 

Check if there is value for $blog...if it is null(that is the problem) then you should check you DB?