Dinesh Uprety
@dineshuprety ·
Public
Read filled request enums safely
PHPLaravel 13 API example based on official Laravel documentation. Source: https://laravel.com/framework/docs/changelog#add-whenfilledenum-method-to-interactswithdata
PHP
CodeSnap // free canvas
Read filled request enums safely
<?php
$request->whenFilledEnum(
'status',
OrderStatus::class,
fn (OrderStatus $status) => $query->where('status', $status),
);
// Further reading: https://laravel.com/framework/docs/changelog#add-whenfilledenum-method-to-interactswithdata