I am using Laravel 5.1 in my application. My MySQL Query is
$result = DB::select(DB::raw("Select * from "
. "(Select u.* from "
. "( "
. "SELECT u2.id as user_id, u2.fname as fname, u2.lname as lname, u2.uname as uname, u2.email as email, u2.address as address, u2.city_id as city_id, u2.website as website FROM users u1, users u2 where u1.city_id = u2.city_id && u1.id = '$this->current_user_id' )
u left join follows f on u.user_id = f.following_id where f.following_id is null
UNION
Select uu.id as user_id, uu.fname as fname, uu.lname as lname, uu.uname as uname, uu.email as email, uu.address as address, uu.city_id as city_id, uu.website as website from users uu where uu.id in (Select u.user_id from (SELECT user_id FROM reviews group by user_id order by count(user_id) desc5
) u left join follows f on u.user_id=f.following_id where f.following_id is null
)
)
T LIMIT 5"
));
How Can I convert it in Laravel Eloquent?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2bYqLRc
via IFTTT
Aucun commentaire:
Enregistrer un commentaire