@reinink @inertiajs @LaraconOnline I love how easy it is to preserve request params even after page reloading. Though it can also be done with a Controller, this way looks more re-usable for me. @inertiajs https://t.co/UxNJ7hbVoB
💡 in Laravel you can do things as the framework is terminating (after request has been processed!)
You can do this in a middleware, using App::terminating with callback or natively with PHP using register_shutdown_function https://t.co/Z6tzN8jdkd
🔥 With Laravel Mix, if you're building Sass files, you can pass a list of PostCSS plugins as the fourth parameter that will only apply to the given file.
This is useful if you want one process to handle multiple things as usually the postCss method will apply to all CSS files https://t.co/B67M4kWOX4
Pro tip for #Laravel @laravelphp developers that use the Ide Helper. Just came with this idea today: listen for MigrationsEnded event and then call ide-helper:models command to generate the helper file automatically after any migrations. #php #ProTip https://t.co/ggwE60m1Q7
Piggybacking off the last 🔥 tip, most Blade templates simply use the `if` directive.
However, there are so many more Blade directives available. These are not only more expressive, but often streamline the code.
Here's a side-by-side comparison: https://t.co/Z2Edmf8kDO
Did you know that you can use the DB facade to create a Partition Metric in Laravel Nova to breakdown email domains? #ProTip https://t.co/eTCoadCWFW
#Laravel tip of the day: how to calculate the sum of ALL records, if you only have a PAGINATED collection? You calculate sum BEFORE the pagination, but from the same query. https://t.co/lpPps70Vqs
When registering routes, you may limit the possible values for a route parameter. In this way you may change your response based on a valid parameter, having an expressive route and not a Query string parameter. @laravelphp @laravelnews https://t.co/3e1AzXVKCu
💡 on @laravelphp @LaravelLivewire you can fire global events from the Component class to communicate between other livewire components, or event, @Alpine_JS components: https://t.co/sXlAInB0ct
Just learned you can have Auth::routes() parameters to filter the routes you want to actually use. E.g.: You can disable the "registration" route 👇
https://t.co/wfW211Xttl
In Laravel, you can explicitly indicate the locale to translate a given element. https://t.co/TCRLh1uSqO
🧐 The @laravelphp docs are a fantastic resource to read over from time to time, given how often new features are added to the framework.
❓Did you know you can add a public shouldQueue method on your job to determine if the job actually *needs* to be queued? https://t.co/9E1uIrmugK
🔥 If you're allowing a ?perPage= query param to be specified for your pagination results, LIMIT it! Particularly if you have a huge number of potential records.
You can do this easily with the native min() PHP function. https://t.co/aNW7K09Zdt
🔥 Sometimes, when using factories to seed random data, I might use a little random check to use an existing model for some relationships so not everything ends up creating new models for its own relations.
It helps seeded data feel a lot more realistic to use. https://t.co/4GboYEfmcM
🍭 You can utilise the Illuminate\Support Str + Arr classes in views without importing them
No need to reach for a fully qualified name or the str_ / arr_ helpers
They are defined as an alias in config/app.php which makes them available in the root namespace
They just work™️ https://t.co/gUcutOebUL
#Laravel tip of the day: if you use Model Observers, and want to update some model and prevent observer from being fired again, you can use Eloquent method $model->saveQuietly(); https://t.co/tMWYznYv5B
#Laravel tip of the day: when seeding data with Faker, you can change locale in config/app.php and it would generate phone numbers and street addresses specific for that region.
Read more in the official docs: https://t.co/eCfSilhyhH https://t.co/cjdrsUgGgk
🚀 Pipelines in Laravel are a nice way of breaking up a sequential process into reusable blocks.
#laravel https://t.co/SLNOLh6DTa
With the new Telescope release, you can easily send Slack notifications for Exceptions with a direct link to Telescope, using the new Telescope::afterStoring() hook. Makes it even easier to track down the context of the error 💡 https://t.co/wTKwcloN44 https://t.co/uC2Pq6Qbgh
🔥 I often find myself keeping validation rules in a method on the model. This lets me reuse them wherever I may need - including in controllers or form requests. https://t.co/QDjYFEN2vM