In this post, I’ll explain how we can use the Laravel’s Builder Object to improve code reusability when creating a series of complex queries.
Archive A Large Database Table
Recently I was tasked with the seemingly simple task of running an alter table to update the data type of a table. However, because the table had tens of millions of rows I soon discovered the task would not be so easy to solve. In this post, I'll explain the solution: creating an archive version of the table.
Understanding Join Queries in Laravel By Example
Improve Laravel Performance using Caching
Recently, I was working on a Laravel website that is powered by a Wordpress CMS with a lot of static content. While developing the site, performance was never really an issue but once we started getting a lot of users the page speed got much worse. In order to solve this problem, we implemented Laravel’s caching facade. In this post, I’ll explain how to did so.
Use preg_match_all and str_replace to replace HTML content in PHP
How Not To Write Unit Tests
5 Things I Learned at LaraconEU 2017
Understand and Implement Laravel Model Events
One of the most powerful functionalities in Laravel is the event. This feature enables all the triggers of various tangentially related functionality to occur throughout the life cycle of a model instance. Plus, events are always listening – meaning you don’t have to explicitly call them in the code to harness their powers. In this post, we’ll implement a sample Laravel model event listener.
Extracting Eloquent Queries to View Composers in Laravel
Whenever working with data using Laravel, it can be easy to write a few small Eloquent queries within your blade files to access the database. However, this practice can quickly spiral out of control if you're not careful, increasing query load time and destroying the performance of your application. In this post, I'll explain how to extract commonly used queries to a view composer so that they can be shared across multiple views that use different blade files.
Use Laravel Homestead's Vagrant Box to Tail Logs
Unit Test A Sorting Functionality using PHPUnit
In this post, I'm going to walk through a small code sample that automates unit testing for a sort functionality. We will call a JSON API URL, and then test that the information received is properly sorted. We'll also make the tests completely dynamic, enabling us to test multiple parameters to sort on.
Use Laravel Elixir’s Gulpfile for Multiple Websites
When starting from a fresh Laravel installation, it’s easy to get started using Elixir and your gulpfile to concatenate, minify, and move any custom CSS and Javascript code from Resources to Public. But what happens when your application takes the next step in its development cycle and expands into multiple websites?