If you want to save an Eloquent model without triggering Eloquent Events use the method saveQuietly()
Lifesaver on model observers when you don't want to recursively trigger its own events (ending in an infinite loop)
🚀 Laravel Performance Tip:
To avoid memory leaks in queue workers, it's often a good practice to restart your workers at regular intervals.
This is from @themsaid's blog. Original post: https://t.co/81gijq6PLT https://t.co/LasZo7eAIM
🔥 Don't forget when Route Model Binding in @laravelphp, you can customize the column Laravel uses to find the model in your route definition now! It's the little details that make Laravel so awesome. https://t.co/qvb63xobj5
It's about the small things that make developing with Laravel such a nice experience!
I haven't thought that that validation would work.. https://t.co/EqPwAXXKaA
While adding a New Column to existing table using Migration, the column is always added at the last.
✅You can use the after() to place the New Column after a specific column.
✅You can also use the first() to place the New Column at the start of the table. #Laravel https://t.co/hNaiFuYZi5
Laravel tip of the day: if you want to ensure that your Route parameter is a number, you can add a regex rule directly in the routes/web.php https://t.co/FZFZumKzdx
👀 Did you know you can pass an optional column to the Eloquent builder latest() method? https://t.co/xvb93iIlc2
Quick Laravel tip: if you want to have a custom validation rule but it's a short one-liner, you may specify it directly in the $rules array, as a callback function. https://t.co/su7vUvZTM4
✨ Eloquent Tip
You can use the "wasChanged()" method to check if a specific attribute was just changed. ✅ https://t.co/4hEUuSVNaq
🔥 You don't need a closing tag when using the @php directive in @laravelphp Blade, you can put some logic on a single line.
It's especially nice to use it to do things like setting default values in a partial with the null-coalesce-assign operator. https://t.co/raQZBfPyxm
@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 👇