🔥 You can create DB indices for transformed versions of columns
⚡️ Database Tip
Most developers are puzzled that indexes are not used for e.g. WHERE LOWER(email) = ?. But contrary to common belief, an index can be created for these cases! It's called a function-based index and is supported by MySQL and PostgreSQL.
🔥 You can temporarily disable timestamps when saving a model
📝 #Laravel Tip | In some cases you don't want the updated_at field the change when updating small things. .. Did you know you could disable the timestamps while saving your data? Here is how... 🔥
#laraveltip #php #code #development #details
🔥 You can create Storage disks on the fly
🔥 Did you know that you can create Storage disks on the fly in @laravelphp? This is super useful when you want your user to provide their own filesystem credentials, e.g. a user can bring their own S3 bucket to your app.
🔥 You can use the `missing` method to customize 404 handling on a route
🔥 Laravel tip: Customizing Missing Model Behavior in route model bindings
By default, Laravel throws a 404 error when it can't bind the model, but you can change that behavior by passing a closure to the missing method.
🔥 You can calculate the `age()` of Carbon instances
#TIL How to calculate the age using a date in Laravel or using Carbon.
#LaravelTip #PHPTip #dev
🔥 You can call `withTrashed()` on a route to accept soft deleted models
🔥 Laravel Tip: Route model binding soft-deleted models
By default, when using route model binding will not retrieve models that have been soft-deleted.
You can change that behavior by using
withTrashed in your route.
🔥 You can call `squish()` on Stringable instances to remove all unnecessary whitespaces
🔥 #Laravel Tip: Hot off the press, the latest release includes the ‘squish’ global helper method by @DwightConrad. It removes all extraneous white space from a string, including between words. It’s like ‘trim’ on steroids :)