Tutorials, and demo projects with Laravel framework.
Host: Povilas Korop


Laravel Daily

PHP tip.
List every enum case in a `match()` and skip the default arm.

If someone adds a new case later and forgets to update the `match()`, PHP throws `UnhandledMatchError` instead of silently doing nothing.

The missing case becomes impossible to ignore.

2 days ago | [YT] | 172

Laravel Daily

Laravel tip.
An API Resource is usually built from a model, but it does not have to be.

Pass a plain array to `new SomeResource([...])` and read it with `$this->resource['key']` inside `toArray()`.

Handy for combining unrelated pieces of data into one response shape.

3 days ago | [YT] | 176

Laravel Daily

PHP tip.
Did you know you can create a new default object directly in the constructor parameter?

4 days ago | [YT] | 168

Laravel Daily

Thank you Pauline for this PR to Laravel Boost v2.5.
Now, when doing `composer require` for Filament or NativePHP, I won't need to run `php artisan boost:install` manually to detect their skills.

Simple change, but so fundamental for DX!

1 week ago | [YT] | 137

Laravel Daily

PHP tip.
In Enums, you may create "helper methods" that describe a few of the possible values in one "group", to make it more readable from the outside.

Similar how Laravel devs have been doing this in Eloquent, for many years.

1 week ago | [YT] | 304

Laravel Daily

PHP tip.
Enums can use traits. Put shared helpers like `values()` and `options()` in one trait and `use` it in every enum you have. Inside the trait, `self::cases()` still points at the enum, so one small file removes the same methods from ten enums.

1 week ago | [YT] | 260

Laravel Daily

Cool new PHP project!
FFmpeg language bindings for PHP
ext-ffmpeg.com/

1 week ago | [YT] | 276

Laravel Daily

NativePHP for mobile v4 is out!
Impressive benchmarks, great potential.
I have a separate video about it, on my other channel NativePHP Daily: https://www.youtube.com/watch?v=Y7zUa...

1 week ago | [YT] | 132

Laravel Daily

Recent Laravel 13.22 version introduced BindWhen PHP attribute, with a condition.
But what is MORE interesting: did you know that PHP 8.5 allows static closures as attribute parameters?

Looks cool.
Link to original PR: github.com/laravel/framework/pull/60862

2 weeks ago | [YT] | 188

Laravel Daily

Laravel tip.
Tired of writing `$data['is_public'] ?? false` in every controller?
Need the default values for the Model?

Set the `$attributes` property on the model.
New Model instances get those defaults automatically, before anything ever touches the database.

3 weeks ago | [YT] | 348