mercredi 13 novembre 2019

I get The Error Call to a member function addEagerConstraints() on integer

  1. This is normal code
  2. TractorTable class
  3. UserReviews class Following Code

    public function getReviewAvgAndCount() { return $this->hasMany(UserReview::class, 'tractor_id');

    }

    function getAverageRatingAttribute() { return ($this->getReviewAvgAndCount()->count()); } UserReview:

    public function tractorTable() { return $this ->belongsTo('App\Model\TractorTable','tractor_id'); } Call Controller:

    TractorTable::with('tractorImage','tractorSpecData','getAverageRatingAttribute','drive')->orderBy('tractor_id', 'desc')->take(5)->get();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire