Eloquent Many-To-Many: Simple Query Example

preview_player
Показать описание
In this video, I'm answering a question from the comments, helping to write a certain Eloquent query.

- - - - -
Support the channel by checking out our products:
Рекомендации по теме
Комментарии
Автор

Was it right to show the "Resource #5"? 'cause it's a consultant resource, and the goal was to filter only the partner ones, right?

marinaberetta
Автор

yours tips worth a million to the community we really appreciate the great work you are doing. ✊✊✊✊✊✊✊✊

SinghatehAlagie
Автор

You're very essential for the community !

jacquesmatike
Автор

Hi! What do You think about: {{ $project->resources->implode('name', ', ') }} instead of foreach in the td ? Thanks

GergelyCsermely
Автор

{{$project->resources->implode('name', ', ')}} maybe litle shorter. Great tip.

marcincook
Автор

love the videos and the way it is explained.
by the way can I subscribe twice?! 😄😄

ramina
Автор

Hi Povilas,
I have a project where the rules are:
- A product belongs to many countries and a country can have many products. (Relationship many to many, here I have no problem)
- A product can have many presentations depending on the country. (Here is my problem)
- Presentations are additional columns to the product such as quantity and price

miguelr.miller
Автор

For the comma separated list, you could use
{{ $project->resources->pluck('name')->implode(', ') }}.
This is one line instead of 3 and more readable, no?

paulfontaine
Автор

Millions of thanks from me. You helped me a lot. Changed how I wrote those codes. Just have one question, about Laravel mix, how to use with stylus? Found from web search but unclear explanation. Maybe a video on that. Thanks

amirulidzham
Автор

Hi I learned a lot about laravel because of you, Now I'm confused about what scenarios should use polymorphic and belongs to if I have an Expense App with Income, Expense and Categories is it better to use it of polymorphic instead of simple Belongs to (Many) Relationship?

ramilgutana
Автор

very nicely explained, it really helps thanks for sharing.

ironspider
Автор

Instead of looping resources you can as well make use of collection implode it wont add an extra comma at d end

spartacusyusuf
Автор

Hello Povilas, I've been following your lessons for long time.
I'm interested in buying your courses.
In one of your YouTube videos you mentioned a special discount for people from certain countries.
I'm from Colombia South America where the currency is too weak.
Is it possible to get the discount?
Thanks in advance.

augustomoradiaz
Автор

Will there be subtitles after your course? I really want to buy them, but my English is not very good. If there are subtitles, I believe I can slowly translate them one by one.

Daniel-xieb
Автор

Hi. I've learnt many things from you. Thanks a lot.
I have a question about laravel performance in general.
I cache views, config, route. I cache queries also where possible, but project anyway seems slow. 2-4 sec initial server response time.
What else could I improve.
I'm including 50-60 small partials. Does number of partials included in views affect performance?

vitalikartsivadze
Автор

Hi... I want to ask about database manager... which app are you using for database management...

MudassarYaseen
Автор

hello there, instead using in blade with foreach loop, why dont you pass there only something like $project->resources->implode('name', ', '); ?

siberfx-dev
Автор

can you make video on how to create stats of the user by week month and year

TariqSajid
Автор

Sir i have question and its related to relationship. Sir here is example. E.g i have two users and every user have 20 books so now on relationships i want to get only 5 books of each user. So 10 books for 2 users. Sir i searched about it but not get. When i used take(5) its totally take 5.

NotBeHaris
Автор

Hello,

is there a way to make expand api in Laravel

mohmmadazzam