vendredi 2 décembre 2016

With query Issue in Eloquent

I have following query which works fine and gives result for StatusType

AddOnModel::with('StatusType')->get();

But when I write below, it does not bind StatusType Records

AddOnModel
::select(\DB::Raw('A.AddOnID, A.AddOn, Count(R.AddOnID) as Total'))
->from( 'tblAddOn as A' )
->with('StatusType')
->leftjoin( 'tblrevenue as R', \DB::raw( 'R.AddOnID' ), '=', \DB::raw( 'A.AddOnID' ) )
->groupBy("A.AddOnID", "A.AddOn")->get();

The part which does not work is this one: ->with('StatusType')

Am I doing something incorrectly?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire