Do you know Laravel have released version 9.49?
The Laravel team released 9.49 this week with support for casting an array of enums, CLI prompts, and more
--
Be sure the check out the changelog as this week’s release is chock full of new additions, fixes, and changes from the last two weeks; most of the Laravel team was at Laracon EU last week.
There have 9 new updates for Laravel version 9.49.
1. Support for casting collection or array of enums
2. CLI prompts
3. New TestResponse JSON assertions
4. “missing” validation rules
5. HTTP client error handling methods
6. Configurable timezone support for queue worker output
7. No action on the deletion of foreign keys
8. Add force delete quietly to soft deleted models
9. Array sortDesc() method
Support for casting collection or array of enums
Ralph J. Smit contributed support for casting arrays of enums:
use App\Enums\ServerStatus;
use Illuminate\Database\Eloquent\Casts\AsEnumCollection;
protected $casts = [
'statuses' => AsEnumCollection::class.':'.ServerStatus::class,
];
And here’s an example of using the array version:
use App\Enums\ServerStatus;
use Illuminate\Database\Eloquent\Casts\AsEnumArrayObject;
protected $casts = [
'statuses' => AsEnumArrayObject::class.':'.ServerStatus::class,
];
See the Casting Arrays Of Enums documentation for more information.
CLI prompts
Jess Archer contributed the ability to automatically prompt the user for missing command arguments instead of returning an error. This feature can be used by implementing the PromptsForMissingInput
interface:
use Illuminate\Console\Command;
use…