I need to select only entries with a unique values 'who_id'
$history_today = DB::table('view_history')
->select('girl_id', 'who_id', 'girls.name as name', 'girls.main_image', 'view_history.time', 'girls.age',
'cities.name as city_name', 'girls.city_id')
->where('girl_id', $girl->id)
->where('who_id', '!=', null)
->where('who_id', '!=', $girl->id)
->leftJoin('girls', 'girls.id', '=', 'view_history.who_id')
->leftJoin('cities', 'girls.city_id', '=', 'cities.id_city')
->orderBy('time', 'DESC')
->distinct('who_id')
->paginate(15);
But in this case, I get all the records.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2XAYGcN
via IFTTT
Aucun commentaire:
Enregistrer un commentaire