Support the ongoing development of Laravel.io →
posted 9 years ago
Eloquent

hi friends

I am new to laravel. I am working on a project with complex query (complex to me :-) Please let me know how to approach this query thru eloquent or suggest any study material.

Tables userTable
id
name

roleTable
id
name

role_user_table
role_id
user_id

topic_table
id
title

role_topic_table
role_id
topic_id

detail_table
id
content
topic_id // fk topic table
author_id // fk user table

Queries

Query 1 all topic_table where
atleast one role_id (of role_topic_table) matches with
atleast one role_id (of role_user_table) and
user_id = given_user_id

Query 2 all detail_table that belongs to topics selected in Query 1
or all detail_table where author_id = given_user_id

TIA

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.