Recent Tweets

Recent Articles

#json #api

Forcing all API requests to accept JSON

When I'm building an API, I usually only design it to accept JSON requests. I think this approach is pretty typical with modern Laravel applications. But by default, Laravel doesn't do anything to enforce this.

Read full article []

Laravel Middleware: Put in Routes, Controller, or Elsewhere? (4 Options)

If you have a Middleware, where you should use it: in the Routes file or in the Controller? Here are the FOUR options.

Read full article []


Everything you need to learn about Cache in Laravel

Within Laravel applications, the cache is the act of transparently storing data for future use in an attempt to make applications run faster.

Read full article []

#eloquent #performance

Increase performance by using Eloquent's `setRelation` method

While working on the upcoming Oh Dear redesign, I noticed that list that displays all sites of a team was very slow. To display that list, a lot of queries were used. With a couple of minor adjustments, I could reduce the number of queries...

#security #encryption

Generating a secure encryption key for a custom Eloquent model cast

Yesterday, I posted a tip on Twitter about using a custom Eloquent attribute cast to handle encryption. Doing this, allows you to use a custom key per model, which can increase the security of your...

Read full article []


Macros in Laravel

Laravel's `Illuminate\Support\Macroable` trait allows you extend classes at runtime with custom methods.

Read full article []

#eloquent #database

Eloquent power joins

If you have some experience using databases, it is very likely you have used joins at least once in your career. Joins can be used for a bunch of different reasons, from selecting data from other tables to limiting the matches of your query.

Read full article []

#requests #testing #factories

Using Request Factories for Gorgeous Feature Tests

Request Factories make testing requests in Laravel even more enjoyable. Let's check them out and see what's possible!

Read full article []