Give your Laravel project the perfect finishing touches It’s time to wrap this project up and move on to more advanced functionality in Laravel. Before we do, we need to add a couple of additional features to our Car Management Project, like deleting photos. This was a fun little project and in my opinion a little better than a traditional to-do list. https://medium.com/geekculture/laravel-p46-controller-destroy-cmp-6dab2b3da6aa Displaying All Images on the Show Page There is an issue with our show page. I’m sure you’ve caught that already. When we were just adding URL’s to other sites, it was easy to display the image.

Elevate your Laravel apps with Vue, Tailwind, and Vue Router Do you keep your backend completely separate from your front-end or do you try to integrate the Vue and Laravel structure into one project? I prefer the latter. It’s not as intuitive as it should be. I used to love the UI presets before, where you can select either React or Vue and move on. Although not terrible, we do need to set this up properly.   Installing Vue First, setup a new Laravel projects. I’m using Docker on a Mac, so my installation is pretty straightforward. curl -s “https://laravel.build/laravel-vue”

Simplify your Laravel setup with a seamless Docker environment on Windows We looked at setting up an existing project on Windows with Laravel, but we haven’t looked at setting up a new project. It is different and simpler than bringing in an existing project. https://blog.devgenius.io/setting-up-an-existing-laravel-application-100-with-docker-on-windows-870176679819 The first thing that you’ll need to do is make sure that your new PC is up-to-date. Next, you’ll need to update WSL. Open PowerShell and run the following command: wsl –update. Install Docker Can’t do much without Docker. Go to https://www.docker.com/ and download the latest version of Docker for Windows. Run through the prompts to install Docker.

Build powerful data-driven interfaces with Laravel, Vue, and DataTables Everything that I’ve seen so far on how to setup DataTables did not yield the kind of results that I needed. I wanted a simple integration of DataTables into my Vue.js/Laravel project, but that was proving more difficult to find than not. This shouldn’t be as difficult as it was made out to be. Let’s take an extremely simple approach to this. Read the previous article on setting up Vue and Vue-Router into the Laravel project. https://blog.devgenius.io/laravel-9-x-with-vue-tailwind-and-vue-router-4c2da39831ea The end goal of this article is to have a functioning DataTables example that

Generate visually rich Excel files directly from your Blade views We covered exporting items from a database table to a sheet, but we haven’t really covered on how to customize that sheet. https://dinocajic.medium.com/laravel-excel-p9-exports-bff04e5c2c14 What we want to do is create a unique way to display content, maybe even injecting some items that are not stored in the database. This involves using blade components in Laravel. One step at a time though. First, we’ll need to create our Exporter. php artisan make:export ViewExporter –model=User This is what the command generates. <?php namespace App\Exports; use App\Models\User; use Maatwebsite\Excel\Concerns\FromCollection; class ViewExporter implements FromCollection

Effortlessly generate Excel files for reliable data sharing I think we’ve gotten to a good point with Imports in the previous 8 articles. It’s time to switch to exporting data into Excel sheets. Laravel-Excel is pretty amazing. It simplifies all of this for us. Since we’ve been working with our User model this whole time, let’s create a quick export. First thing is to create our Exporter and specify that we want to use the User model. php artisan make:export UsersExport –model=User This generates a new file and a new directory under the app directory called app/Exports/UsersExport.php. <?php namespace App\Exports; use App\Models\User; use Maatwebsite\Excel\Concerns\FromCollection; class UsersExport implements

Scale up data imports with queue-based execution The time has come to put it all together. We’ve slowly built on in the previous articles and have increased our speed. With batch inserting we were able to insert a batch of 100 rows (even though you can pick any number). With chunk reading, we eliminated the memory problem of loading the entire excel sheet into memory and instead loaded a 100 rows worth of data (even though again we could have increased or decreased that number to whatever we wanted). But there’s still one more issue. What if the file is

Handle massive datasets with efficient chunk reading In our last article, we looked at Batch Inserting where we inserted a 100 rows at a time. Chunk reading deals with pulling a certain amount of data into memory. Without chunk reading, we pull the entire sheet into memory. That could be substantial if there is a lot of data inside the excel sheet. https://blog.devgenius.io/laravel-excel-p6-batch-imports-261c80e46448 How to use Chunk Reading? I hope that you’re seeing a trend appear: most things are pretty straightforward with Laravel-Excel. All we have to do is implement the WithChunkReading concern and use the chunkSize method. ?php namespace App\Imports; use App\Models\User; use

Efficiently process large-scale data with batch imports What we’ve done so far when importing our excel sheets into our database is create an import for each row: an actual insert query occurs each time. What if we had a 1000 rows? That’s right: 1000 insert queries would occur. Laravel does allow for batch inserts and Laravel-Excel accommodates that form of inserting. If you set a batch size of 100, that means that only 10 queries occur, not 1000. Batch inserting limits the number of queries done and increases the speed. The number of rows to insert in a single batch

Seamlessly process spreadsheet formulas with Laravel-Excel One last thing to note on importing excel sheets is that often formulas do not behave as you intended them to behave. If you start receiving errors, take a look at the excel sheet itself and figure out if there are any formulas hidden inside. https://blog.devgenius.io/laravel-excel-p4-importing-multiple-sheets-conditional-loading-d70db3ae1409 Let’s take a look at an example with one a formula that references data on the sheet that’s being imported. Formula on Import Sheet The excel sheet that we’ll be looking at has the following columns first_name last_name email password full_name The first four columns contain static data,