lundi 1 avril 2019

Laravel eloquent get model property of current query

I'm trying to do where clause for fortune_code inside joindraw table, comparing with the lucky_fortune_code from product table. How can i access and do the check?

Product::where('status', StatusConstant::PT_ENDED_PUBLISHED)
       ->where('lucky_fortune_code', '<>', '')
       ->with(['joindraw' => function ($query){
              $query->where('fortune_code', $this->lucky_fortune_code)
                    ->with('user');}])->desc()->get();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire