You can include the Champion Model at the top of the file with use App\Champion; and then just Champion::select()... or just App\Champion::select().... Not certain about Champion::class()->select()... but it looks like it should work.
So this should work out:
return App\Champion::select(
DB::raw("DATEDIFF(IFNULL(DATE(champions.lost_on), NOW()), DATE(champions.won_on)) as length, player_id")
)
->orderBy('length', 'desc')
->groupBy('length', 'player_id')
->limit(1)
->get();
You can even do this I think since you want only the first result:
return App\Champion::select(
DB::raw("DATEDIFF(IFNULL(DATE(champions.lost_on), NOW()), DATE(champions.won_on)) as length, player_id")
)
->orderBy('length', 'desc')
->groupBy('length', 'player_id')
->first();
As for the foreach loop, what are you trying to do there?
It seems you have a $title collection. I do not see the relation to the first query.