1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 13:24:03 +00:00
laravel-tips/content/tips/you-can-use-the-boolean-date-string-methods-on-the-request-object-instead-of-manually-type-casting-request-parameters.md
Samuel Štancl d5718fbbc8 Week 27/2022
2022-07-10 21:21:46 +02:00

691 B
Raw Permalink Blame History

title tweet_id thread_slug author_username images created_at slug
You can use the boolean() / date() / string() methods on the Request object instead of manually type-casting request parameters 1545466006096687110 weekly-thread-2022-27 ryangjchandler
https://pbs.twimg.com/media/FWhgKQPXwAELDpV.jpg
2022-07-08T17:53:03+00:00 you-can-use-the-boolean-date-string-methods-on-the-request-object-instead-of-manually-type-casting-request-parameters

Instead of explicitly type-casting or wrapping request parameters, you can use some of Laravel's utility methods on the Request object. It comes with a boolean() helper, date() helper and a string() / str() helper!