mardi 12 avril 2022

Method withCount does not exist

I am using laravel 5.4 so i'm trying to count number of relations between two models "Person" and "Permanance" so this is how it is called in my controller $persons = Person::all()->withCount('Permanance')->get(); and this is the error i'm getting

(1/1) BadMethodCallException

Method withCount does not exist. in Macroable.php line 74 at Collection->__call('withCount', array('Permanance'))in PermanancesController.php line 41



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire