Can you give me a little bit of help with this?I want to convert this for laravel 5.2, and also add role_users
table with column user_id
and user_role
. Can you help me please?
$career_solutions_data = DB::select("
SELECT
career_solutions.id,
career_solutions.subject,
career_solutions.date,
career_solutions.public,
career_solutions.views,
career_solutions.optional,
career_solutions.on_offer,
users.username,
users.profile_picture,
categories.category,
categories.category_url,
categories.color,
career_solutions_categories.category as sub_category
FROM career_solutions
INNER JOIN categories
ON categories.id = career_solutions.topic_category_id
INNER JOIN career_solutions_categories
ON career_solutions_categories.id = career_solutions.topic_subcategory_id
INNER JOIN users
ON users.id = career_solutions.user_id
INNER JOIN privacy_settings
ON privacy_settings.user_id = users.id
WHERE users.deleted_at IS NULL
AND (
(privacy_settings.career_solutions = 0 AND public = 1 )
OR (users.id IN (
SELECT contacts.contact_id
FROM contacts
WHERE contacts.user_id = $id
)
)
)
OR users.id = $id
ORDER BY date desc limit 5000
");