This episode is for members only

Sign up to access "Build a Livewire CSV Importer/Exporter" right now.

Get started
Already a member? Sign in to continue
Playing
18. Showing all imports

Transcript

00:00
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.

Episode summary

In this episode, we build out a super simple "All Imports" page to help us keep track of every import we've got. Our goal here is to make it easy to monitor their status, when they were started, and how many records were in each import.

We kick things off by setting up a new route and view for imports, mostly by copying what we already have for exports and then tweaking it to fit our needs. This includes updating the table columns to show just the info that's relevant for imports: when each import started, the record count, and the status. Since we don't need any download functionality, we clean that out for imports.

After wiring everything up with Livewire and making sure we paginate only the current user's imports, we tidy up the blade files and double check the styling so it actually looks good. Once we're happy with the table, we make sure imports is linked in our navigation just like exports. Now you can easily jump between imports, exports, and the main dashboard from anywhere in the app.

That's it for this one! In the next episode, we'll deal with updating the status when an import finishes, and try things out with a bigger data set to see how it all works.

Episode discussion

No comments, yet. Be the first!