Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

Alias for eager loading #2183

Open
Romik90 opened this issue Apr 12, 2020 · 10 comments
Open

Alias for eager loading #2183

Romik90 opened this issue Apr 12, 2020 · 10 comments

Comments

@Romik90
Copy link

Romik90 commented Apr 12, 2020

Hi. My problem is that I need something like an alias for eager loading in case when I use same relation. For example imagine if I have cms with leads. Every lead has the responsible manager. I wanna get analytics of managers with different constrains
This code doesn't work
image

So I have to create two relations with same code inside
image

Maybe I'll need to have another request to the same Lead model so I need to create one more method with the same logic inside. What could be an alternative solution?

@leon0399
Copy link

Totally agreed! Such behaviour already exists for relationships counts, and just have to exist on relationships themselves

https://laravel.com/docs/8.x/eloquent-relationships#counting-related-models

@Lemmings19
Copy link

Lemmings19 commented Jan 30, 2021

+1

@crissi
Copy link

crissi commented Feb 4, 2021

Duplicate of #1396

@PaolaRuby
Copy link

+1

@PaolaRuby
Copy link

There have already been pull requests PR #31976

@fredsal
Copy link

fredsal commented May 27, 2021

+1

@erikn69
Copy link

erikn69 commented May 28, 2021

+1

1 similar comment
@marezelej
Copy link

+1

@crissi
Copy link

crissi commented Jun 22, 2021

there is a pr made recently here: laravel/framework#37656 🙏

@fredsal
Copy link

fredsal commented Jun 22, 2021

Good luck

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

No branches or pull requests

8 participants