Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple whereRelation #57

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

joseraul
Copy link

@joseraul joseraul commented Dec 7, 2023

Work in progress for fixing the following scenario

...
$user = User::create([]);

$task = Task::create([]);
$task->creator()->attach($user);

$task = Task::query()
    ->whereRelation('creator', 'id', $user->id)
    ->orWhereRelation('assigned', 'id', $user->id)
    ->get();
...

ideally, we would need something like:

MATCH (task:`Task`),
 (task)-[`rel_created_by_user`:`CREATOR`]-(creator:`User`),
 (task:`Task`)
OPTIONAL MATCH (task)-[`rel_assigned_to_user`:`ASSIGNED`]-(assigned:`User`)
WHERE
    id(creator) = $iduser AND 
    id(assigned) = $iduser
RETURN task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants