'Laravel and Redmine Database // query builder with eloquent
I'm new in Laravel (5.4). I work on redmine database and I want to have users role. The tables are :
users : id, login, hashed_password,...
members : id, user_id, project_id, created_on, mail_notification
member_roles : id, member_id (foreign key), role_id, inherited_from
roles : id, name,...
My query works perfectly but I want to make it fluent without "->select(...)" :
$membersRole = DB::connection('redmine')
->select('SELECT roles.name as role, user_id
FROM users, members, projects, member_roles, roles
WHERE projects.id = ?
AND members.user_id = ?
AND members.project_id = projects.id
AND members.id = member_roles.member_id
AND roles.id = member_roles.role_id
LIMIT 1', [$id, $userId]);
How can I do it ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
