DEV Community

Discussion on: How to implement a simple like system with Laravel

Collapse
 
bdelespierre profile image
Benjamin Delespierre

Your $model variable shouldn't be an stdClass instance. It should be a Post instance. (or anything with the Likes trait).

I suggest you dump this variable with dd($model) in the controller before returning the view and try to understand what's going on.

Good luck!

Collapse
 
fatahidzhar profile image
FatahIdzhar • Edited

I've tried it, it's still an error in the
Undefined property: stdClass::$likes

and already using dd()