5
I am making a query using Query Builder
$users = DB::select( DB::raw("
SELECT users.* from users, permissions_customers WHERE
permissions_customers.customer_id in
(
SELECT permissions_customers.customer_id from
permissions_customers
WHERE
permissions_customers.user_id = ?
)
AND
permissions_customers.user_id = users.id
GROUP BY users.id
"), array(5));
As you can see in T-SQL the return is a result of the users table, however it returns me an array of Objects of type stdClass, I would like these results to be a list (Collection) of Eloquent Model for me to access its methods of relation, I was able to loop the results and put them in a Collection but when I try to create an Eloquent Object Model from my stdClass object, the Eloquent model doesn’t seem to work as it should not be able to query the relationship methods