Source: medium.com

Laravel Castable Requests

Category: Laravel

The eloquent approach dealing with casts is attractive and takes away the complexity of creating Cabron objects from date columns, converting enums to booleans, parsing JSON to an array, or even Laravel’s custom casts introduced in Laravel 7 that can format your application phone numbers, country codes or anything else you can think of. Have you ever thought about using eloquent attribute casting with request objects?

Try to find the easiest way possible to use this package and make your Laravel Requests castable. We tried our best and I hope we could make the usage as simple as you thought… In the example above the input will be mutated in the following way: For more details see Github documentation.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners