Keeping up with the Laravel ecosystem can feel like a full-time job. Let's look at the actual updates that will change how you write code this week.

  • How to use Laravel's new query builder features
  • Simplifying state management in Livewire
  • Cleaner reactivity with Alpine.js updates

Streamlined Validation in Laravel

Laravel now lets you define your validation rules right inside your form request classes using a cleaner syntax. This saves you from jumping between multiple files just to add a simple check.

Here is how you used to write rules in a separate method:

public function rules() {
    return ['email' => 'required|email'];
}

And here is the new, cleaner way to define them directly:

use Illuminate\Validation\Rule;

public function rules(): array {
    return ['email' => ['required', 'email']];
}

The key takeaway is less boilerplate code and better type hinting out of the box.

Cleaner Livewire Component States

Livewire makes building dynamic interfaces easy without leaving PHP. Recent updates improve how component properties handle data binding and lifecycle hooks.

Here is the old way of resetting a property:

public function clear() {
    $this->search = '';
}

Here is the new shorthand method using updated traits:

public function clear() {
    $this->reset('search');
}

Using the built-in reset method keeps your component logic DRY and less prone to typos.

Common mistakes

A common mistake when upgrading is forgetting to clear your framework caches. Always run artisan config:clear and view:clear after pulling in new package updates. Another trap is mixing old data binding syntaxes with new ones in Livewire, which can break your reactive DOM updates.

Open up one of your active side projects today and try refactoring a form request using the new validation syntax.