Laravel Excel: Import with Relationships

  Рет қаралды 26,961

Laravel Daily

Laravel Daily

Күн бұрын

Пікірлер: 83
@intipontt7490
@intipontt7490 3 жыл бұрын
Using lazycollection in the constructor by rewriting the query as User::select('id', 'name', 'email')->cursor()->remember() could save you some memory. Considering imports can be often pretty large, a good idea is to use chunk reading in laravel excel (even if you don't need it at first) to prevent scaling issues.
@wahyusetya172
@wahyusetya172 2 жыл бұрын
i dont find in the laravel docs about how much time this cache will be stored, since the data can be dynamic, i think this approach is not the best idea
@kirilllubynets8592
@kirilllubynets8592 2 жыл бұрын
Very thanks for your video. hellow from Ukraine
@jannusdomingo5681
@jannusdomingo5681 3 жыл бұрын
We've been struggled on understanding the eloquent query I mean the Joins. I had the idea of you making a tuts on what the left joins & inner joins means in Eloquent, I mean you show us the old way and then convert it in eloquent way. Btw all your tuts help us a lot! 🍻
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Added to the to-do list, will come up with some useful angle about joins
@jannusdomingo5681
@jannusdomingo5681 3 жыл бұрын
@@LaravelDaily Thank you so much my fav tutor here! We're excited! 🍻😊
@intipontt7490
@intipontt7490 3 жыл бұрын
joins don't work differently in eloquent. Unless you mean relationships, but those are not joins at all most of the time. You can dump the query to inspect the generated sql.
@jannusdomingo5681
@jannusdomingo5681 3 жыл бұрын
@@intipontt7490 yeah but we do not know where to start on how to convert our joins in to eloquent
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Can you email me povilas@laraveldaily.com a few examples of such joins? Then I may try to convert them in the video, would be the most practically useful for everyone. @Jannus Domingo
@diggdiganta
@diggdiganta 3 жыл бұрын
Please provide an example if we need to import to multiple database tables from one CSV file.
@MarkKulishov
@MarkKulishov 3 жыл бұрын
Have you compared the speed of the database selects with the speed of the collection search? If there are many users, the collection search should be longer. The second question: it might be more optimal to translate the collection of users into an array, where the key is an email. Then the substitution of user IDs would occur instantly
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Valid points, maybe it would speed up even more, haven't tried.
@andrewjackson3890
@andrewjackson3890 2 жыл бұрын
Very useful for me, thank you!!!
@roselfrancisco1463
@roselfrancisco1463 2 жыл бұрын
The best tutorial as always!
@phanirajk9144
@phanirajk9144 3 жыл бұрын
Thanks a lot. It is really helpful.
@Gosa-li1ei
@Gosa-li1ei Жыл бұрын
Thanks so much Dear Sir.
@gurramkondabhargav8340
@gurramkondabhargav8340 2 жыл бұрын
Great sir, At a time It will insert to Two different DB's
@jonathanoeijoeng
@jonathanoeijoeng 2 жыл бұрын
Hi, your channel is helping me a lot to understand laravel better. Regarding to import from csv file, is it possible to import sheet into multiple tables? Thanks so much
@3rkan0zturk
@3rkan0zturk Жыл бұрын
Awesome, thank you👏
@oimso
@oimso 3 жыл бұрын
Nice Video, How to export two or more queries to excel?
@surflaweb
@surflaweb 3 жыл бұрын
Great example!!
@majid_alsaidi
@majid_alsaidi 2 жыл бұрын
I have for example a user table and role table. The relation is hasMany with a pivote table between them. there is no actual column between the two tables. can we import users from csv witht the role id?
@ammarqureshi4887
@ammarqureshi4887 3 жыл бұрын
Thankyoy can make how get separate array like laravel relationship with inner joins .
@pkeerthana723
@pkeerthana723 Жыл бұрын
Is there any way to validate unique email when emails are stored in database as encrypted data and display error message row wise in blade file.
@devaes
@devaes 3 жыл бұрын
good timing ! thank you sir
@akichoe
@akichoe 2 жыл бұрын
hi.. can i get simple import with multiple start and end date per id? example; one id have many start and end date.
@ImamAdiNata
@ImamAdiNata 2 жыл бұрын
how about importing one excel file into 2 tables in database?
@kennethkipchumba2532
@kennethkipchumba2532 Жыл бұрын
What would be an example use case for such a feature ?
@BoiteSphinx
@BoiteSphinx 3 жыл бұрын
Thanks for your video! How should I use a trait if i'm workng with multiple sheets. In my app i have multiple sheets, most of them have a manufacturer. Right now I use a trait that fetches the manufacturer based on its name, but everytime i switch sheet, the trait's constructor gets called, how can I limit database interractions with such layout?
@thedream8420
@thedream8420 Жыл бұрын
Sir do you have a video of multi sheet excel import in database in different tables?
@LaravelDaily
@LaravelDaily Жыл бұрын
No
@NathanBudd
@NathanBudd 3 жыл бұрын
What about if the `user_id` is a non-nullable foreign key? I realise that we could do `firstOrCreate`, but how do you then update the `users` in the constructor?
@rolandosanches2344
@rolandosanches2344 3 жыл бұрын
You can add then to users collection, using prepend() or push() method
@kanzuleman4906
@kanzuleman4906 2 жыл бұрын
while i am doing the same as you are but it is giving me error that undefined index title, title is present in my role class which is actually in relation with the user class one user has one role how can i fix that?
@hamzaashraf9529
@hamzaashraf9529 3 жыл бұрын
and it would be great if you add a button under your course like send offer (someone can offer you a buy price for every single course).
@aungchanoo8682
@aungchanoo8682 3 жыл бұрын
Can you show us how to import images from excel file?
@bamswisnu4823
@bamswisnu4823 2 жыл бұрын
why im running local 'error undefined index: amount' ? please help solving
@shelderrr
@shelderrr 3 жыл бұрын
What about pivot tables?
@yogeshwarbarai9686
@yogeshwarbarai9686 Жыл бұрын
The file needs to be in csv is mandatory or it can also work with xlsx extension type?
@LaravelDaily
@LaravelDaily Жыл бұрын
Should work with xlsx too, but try it out.
@bibhasash7371
@bibhasash7371 2 жыл бұрын
how to configure header columns with column names having space between like fist name
@marcinrobertkazmierczak
@marcinrobertkazmierczak 2 жыл бұрын
Hello Povilas. I'm your student :) I have bought your Laravel Excel course. What if I'm importing file for example with books, and I have some authors which are not present in database? How to add those missing authors in one import and sync them to books via pivot table :) ?
@LaravelDaily
@LaravelDaily 2 жыл бұрын
It's been a while since I worked with Excel import, so I don't really remember. Googled a bit, found a few resources: laracasts.com/discuss/channels/laravel/laravel-excel-import-csv-data-relationed-to-another-table github.com/SpartnerNL/Laravel-Excel/issues/1966
@fabrizziomorenor.6495
@fabrizziomorenor.6495 2 жыл бұрын
Exist a way i can read the heading row and import in every row imported. Example CARS column..import and set in a column name category...put the CARS string.??? :P
@Anonymouseab
@Anonymouseab 2 жыл бұрын
hi bro thanks really too it is helpful but i am getting this error bro Trying to get property 'id' of non-object
@GergelyCsermely
@GergelyCsermely 3 жыл бұрын
Thanks
@noplay6360
@noplay6360 3 жыл бұрын
Hey Povilas What are your thoughts about inertia with vue and laravel backend? I haven't seen a video about inertia on your channel. So currently I'm thinking about learning livewire, but looking at performance, idk if it's any better than intertia + vue.
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Planning inertia content a bit later on the channel, not sure why
@zineddineabdellatif4837
@zineddineabdellatif4837 2 жыл бұрын
greate like always
@sarojguragain554
@sarojguragain554 3 жыл бұрын
Sir, How to use laravel Log with slack in localhost.
@jahanzaibhussain7598
@jahanzaibhussain7598 3 жыл бұрын
just a big wow!
@abedshamia8094
@abedshamia8094 3 жыл бұрын
What if there were no similar column names, and the only relatable column was user_id? :/
@pondokkoding5023
@pondokkoding5023 2 жыл бұрын
how to register in your course? there is no register button in your website
@LaravelDaily
@LaravelDaily 2 жыл бұрын
You need to purchase that course, there's no "register" button, there's "buy" button.
@pondokkoding5023
@pondokkoding5023 2 жыл бұрын
@@LaravelDaily okey have done
@pondokkoding5023
@pondokkoding5023 2 жыл бұрын
how to import db3 file into database in laravel, Sir?
@_fajarsetianto
@_fajarsetianto 3 жыл бұрын
How to validate that excel file for each row before saving into database?
@LaravelDaily
@LaravelDaily 3 жыл бұрын
I have a video about it: kzbin.info/www/bejne/pqTLp4p5eN52fdk
@Antonius77
@Antonius77 2 жыл бұрын
А что если отношения Many to Many через pivot таблицу?!
@tech.business-agencedigita4820
@tech.business-agencedigita4820 11 ай бұрын
I have this error : Failed to open stream: Permission denied
@webpakistan9589
@webpakistan9589 3 жыл бұрын
what if we need to export 500000 rows?
@PsyHooZ
@PsyHooZ 3 жыл бұрын
with DB already includes a tons of users... with User::all() your memory say: "OK, I'm out" ?
@Remls
@Remls 3 жыл бұрын
@@PsyHooZ Just download more memory, ez /j
@popelyshyn
@popelyshyn 3 жыл бұрын
Chunks?!
@SeyedSadeghAtaii
@SeyedSadeghAtaii 3 жыл бұрын
It's a good point but if you check the premium course he provides, or the documentation for laravel excel it should be all you need to know.
@konstruktion
@konstruktion 3 жыл бұрын
Can you make a video where you explain how to write a method in the test that creates (Jetstream) a user via Factory and logs in with that. At Laracasts I only got "it's so simple" answer and thus not helpful. 🙏🏻🙏🏻🙏🏻
@LaravelDaily
@LaravelDaily 3 жыл бұрын
$user = User::create() auth()->login($user); Or do you really need a video about it?
@konstruktion
@konstruktion 3 жыл бұрын
​@@LaravelDaily $user = User::factory()->create(); auth()->login($user); $response = $this->get('/clients'); $response->assertStatus(200); Not working, because is not so simple. :(
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Then it's something with the logic of your application and why it doesn't return 200. Maybe it returns 403 because of some permissions? Not sure, needs debugging.
@Roy-xd5mw
@Roy-xd5mw 3 жыл бұрын
How to export image in excel with other data
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Why would you want to export images into excel? Excel is not typically used for storing images.
@Roy-xd5mw
@Roy-xd5mw 3 жыл бұрын
@@LaravelDaily if we use js script we can easy export images So, why not with laravel sir ?
@Roy-xd5mw
@Roy-xd5mw 3 жыл бұрын
Please guide or make some video in which we can easily export images with other data from table
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Sorry I don't have any examples of images, I just personally haven't encountered excel files that would contain images, in my opinion Excel files are for calculations and data, not for images. Please read the official docs of Laravel Excel package, maybe they will have something.
@oimso
@oimso 3 жыл бұрын
Maybe this will help you. kzbin.info/www/bejne/jIbIpWWtppdlY9E
@hamzaashraf9529
@hamzaashraf9529 3 жыл бұрын
i'm sorry but your prices are too high 29$,99$ in pakistan 99$ equals to 17,127.49 Pakistani Rupee. 17 thousand no one wants to pay please consider this point. we want to learn quality code but not in this price we can't afford thanks!
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Visit coupons.laraveldaily.com
@adiputra-og9qt
@adiputra-og9qt 2 жыл бұрын
why i can't run composer require maatwebsite/excel in my computer? this is my error: Your requirements could not be resolved to an installable set of packages. Problem 1 - maatwebsite/excel[3.1.36, ..., 3.1.x-dev] require phpoffice/phpspreadsheet ^1.18 -> satisfiable by phpoffice/phpspreadsheet[1.18.0, ..., 1.24.1]. - maatwebsite/excel[3.1.0, ..., 3.1.25] require php ^7.0 -> your php version (8.1.6) does not satisfy that requirement. - maatwebsite/excel[3.1.26, ..., 3.1.35] require illuminate/support 5.8.*|^6.0|^7.0|^8.0 -> found illuminate/support[v5.8.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require. - phpoffice/phpspreadsheet[1.18.0, ..., 1.24.1] require ext-gd * -> it is missing from your system. Install or enable PHP's gd extension. - Root composer.json requires maatwebsite/excel ^3.1 -> satisfiable by maatwebsite/excel[3.1.0, ..., 3.1.x-dev]. To enable extensions, verify that they are enabled in your .ini files: You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode. Alternatively, you can run Composer with `--ignore-platform-req=ext-gd` to temporarily ignore these required extensions. You can also try re-running composer require with an explicit version constraint, e.g. "composer require maatwebsite/excel:*" to figure out if any version is installable, or "composer require maatwebsite/excel:^2.1" if you know which you need.
Laravel Excel Export/Import Large Files: Bus Batch and Livewire
9:40
13 Laravel Tips in 10 Minutes: October 2024
10:14
Laravel Daily
Рет қаралды 4,3 М.
ЛУЧШИЙ ФОКУС + секрет! #shorts
00:12
Роман Magic
Рет қаралды 39 МЛН
Кто круче, как думаешь?
00:44
МЯТНАЯ ФАНТА
Рет қаралды 5 МЛН
БУ, ИСПУГАЛСЯ?? #shorts
00:22
Паша Осадчий
Рет қаралды 2,7 МЛН
8 Career Tips from My 25 Years as Developer
12:08
Laravel Daily
Рет қаралды 6 М.
Laravel Checkout: Database Transactions and Validation
16:24
Laravel Daily
Рет қаралды 29 М.
Laravel Eloquent: Deeper Relationships with One Query
10:37
Laravel Daily
Рет қаралды 143 М.
Laravel API Security: Triple-Check Request TYPES (example "hack")
8:16
Going ALL IN For Onryo Ieyasu Because I WANT THIS CHAMP!!!
11:02
ЛУЧШИЙ ФОКУС + секрет! #shorts
00:12
Роман Magic
Рет қаралды 39 МЛН