In this case I gave up to use ORM Eloquent .
SO I decided to use DB Query builder only.
But I want to drag 'user' model with my 'results' model .
How can I get success ?
$bettings = DB::table('results')
->select('1st', '2nd', DB::raw('SUM(time_laps) as time_laps'))
->where('event_id', $event_id)
->join('type', function( $join) use( $type) {
$join->on('results.type_id', '=', 'type.id')
->where('types.key' , '=', $type) ;
})
->groupBy('1st', '2nd')
->with('user')
->get();
->with('user')
I guess I can not use with() in Query Builder.
Actually I wish I can build ORM Eloquent query than DB Query Builder .
If it's not possible I want to drag user model with results model .
Can someone help me ?