Multi-Join Raw SQL Query To Laravel Query Builder Conversion

preview_player
Показать описание
In this video, we will be looking at how we can convert a complex multi-join raw SQL query into Laravel query builder code.

=== Important Links ===

=== Offer ===

GET ONE MONTH OF FREE CLOUDWAYS HOSTING

Cloudways offers peace of mind and flexibility so you can focus on growing your business and reaching new milestones instead of dealing with server management. With Cloudways, you get an optimized stack, managed servers, backups, staging environment, integrated Git, pre-configured, Composer, 24/7 support, and the choice of five cloud providers: AWS, DigitalOcean, Linode, Google Cloud, and Vultr

=== Support ===

If you want me to continue making this kind of video for free on YouTube, then you can support the channel

eSewa ID: 9843632084

=== Social Media Links ===

Let's be friends

=== Video Related Links ===

=== Other Videos ===

What's New In Laravel 9

New In Laravel Playlist

Laravel Package Development Playlist

Password Validation In Laravel with at least one Letters, Numbers, Upper and Lowercase or Symbols:

Multiple Apis With ForwardsCalls Trait And Code Refactoring Tip - Laravel Hidden Feature:

Laravel Chunking - You Might Be Doing This Wrong - Problem and Solution:

Laravel Tip - Properly Get Data Between Two Dates

Get Data From Multiple Databases In One Project | Laravel Tip

=== Theme, Font and Extensions I use ===

#laravel #php #laraveltip #laratips
Рекомендации по теме
Комментарии
Автор

GET ONE MONTH OF FREE HOSTING

Get $15 credit by using code "LARATIPS" which can last almost a month.

Cloudways offers peace of mind and flexibility so you can focus on growing your business and reaching new milestones instead of dealing with server management. With Cloudways, you get an optimized stack, managed servers, backups, staging environment, integrated Git, pre-configured, Composer, 24/7 support, and the choice of five cloud providers: AWS, DigitalOcean, Linode, Google Cloud, and Vultr

Laratips
Автор

Thanks for the tips.

I have an UPDATE query that I'm struggling with, hope you can solve this.

I have a "users" table with a column "address" where a string value is added. To make things cleaner I created a separate table "locations" to store all the addresses and set up foreignId('location_id') on the "users" table.

"locations" table is then filled by getting unique "address" values from "users" table.

Now I need to update the "location_id" of existing users.

This is what I tried:
$locations = Location::get(); // only about 100 results are there

User::query()
->whereNotNull('address')
->update([
'location_id' => $locations->firstWhere('street', DB::raw('address'))->id
]);

For some reason, the above query is not updating the column.

mediacreations
Автор

should you use "with('roles')" instead of "join"?

adam
Автор

Which theme and extension are using in VS code ?

jeetjeet