Okay I'm going to go through the process of creating out an import page specifically to monitor all of our imports. Of course it's not going to be as complex because we don't have the ability to download and import, we just have a status, a record count and when it was requested
00:15
or when it was started. So let's go ahead and build this out just to make this a little bit more complete. So over in our web routes again we're going to just make this really really simple here. So we'll just use the exports route view, change this over to imports, change this over to imports and of course change the name over to imports as well. Let's go ahead and make out a
00:36
view here called imports and we'll pretty much just grab the exports blade file and put that into the imports blade file. Of course that's going to change, the title needs to change and we will create out an import table. So choose live wire to make an import table and there we go. So this should now work if we switch this over to import table and let's go
01:03
over to the export table under that blade file. Let's copy and paste the entire thing and just change over what we need. So under import table paste this in, let's just change this and then we'll go ahead and pass the actual data down. So we have got no ability to download so we can pretty much confidently get rid of that and then this table header. What do we need to show here
01:28
under each import? Let's say started at because obviously it's not requested necessarily, we've got a record count in here and finally a status. So started at record count status, started at will be the created at date. Record count will be the record count which we have there so let's just get rid of that one and then the status is going to be pretty much the same thing. Import is ready, we'll
01:53
just keep the same name. This will be import record count and this of course will be import created at. Let's iterate over imports as import and we should be good with that. Let's just check everything out in here just to make sure we don't have any other reference to an export and we should be good. So let's go over to the import table and let's pass these down. So imports again come from the
02:26
user because we don't want to show everyone's imports. We're going to say imports latest and paginate 10 and we should be good. Let's just head straight over to that page and import is ready. Yep so we can go over to export here, pretty much grab the same thing, pop that over in the import model and great there we go. So there are a bunch of our imports which we haven't updated the status
02:54
for yet. We will do that in the next episode but we have the record count at least. Okay this looks a little bit odd so let's just make sure that we are styling this properly and let's go up to here. We might just need to, yeah so let's just grab status, replace that out, change that to record count and there we go. Great so this looks good for now. Let's add it to our navigation and then we'll move
03:20
on. So layout navigation to do the same for exports of course just change this to imports and we should be good. So now we can very easily monitor our imports, exports and obviously see our data over on our dashboard. Great let's go into the next episode and look at updating this status when an import actually completes and we'll test this out with a much larger data set as well.
22 episodes•2 hrs 18 mins•1 month ago
Overview
Let's build a powerful CSV importer and exporter with Livewire, completely from scratch.
This can handle millions of rows, be reused for multiple models, and by using queues, doesn't require the browser to be open.
This course is for you if:
You need a robust drop-in importer and exporter component for your models that you have full control over
You want to brush up on some advanced Livewire concepts