Laravel Pro Tips
#database #transactions
🌶️ #Laravel Tip: Yesterday we learned the Automatic Laravel Database transactions. Today, we explore the Manual Database Transactions. 🧠 ✅ DB::commit() ✅ DB::rollback() #PHP #Developers
Bilal Haidar - Available 4 Laravel gigs
#mailables #email
💡Did you know you can preview an e-mail with Laravel? You just need to return an instance of the Mail class and it will open a modal with the preview (if it's a web route). Exactly what I needed for a newsletter feature and it's very helpful to debugging.
Martin Joo
#models #search
Laravel Tip: Very often you have a Form where you allow Users to Search a Model by Title. You can improve the User experience by also returning the results which match the Primary Key. Here is a sample code snippet.
The Laravel Dev
#eloquent #database
#Laravel #Eloquent Tip: Now in Laravel v9.3.0, you can Easily build "where not" SQL clauses using the new "whereNot" method on the Eloquent / database query builder. #Laravel #Database #PHP
Laravel Eloquent
#authentication #users
There are several ways in #Laravel to access primary key of authenticated user. My favorite is 3⃣ #php #Laravel #100DaysOfCode #100Dev #developers
Mohammad Haris ⚡
#performance #database #enums
🔥 #Laravel Tip: DB queries that need to examine string columns will always be slower than queries which only need to examine integer columns. Therefore, consider whether you can use integers in place of strings for those columns. It can make a big difference on large data sets.
Matt Kingshott
#eloquent #database #transactions
🌶️ #Laravel Tip: You can mix both Database operations and Eloquent operations inside a single Laravel database transaction. Two transaction flavors are offered: Automatic and Manual. Let's check the Automatic one. ⚡️ #PHP #Developers
#exceptions #404 #logging
Quick @laravelphp tip: Trying to figure out what is causing an error that isn't in your logs (e.g. a 404)? Temporarily override the `$internalDontReport` array in your exception handler to allow any exceptions to be reported. Run the request again and check your laravel.log
Gilbert Pellegrom 🍋
#blade
#Laravel Tip 🔥 You can add classes conditionally to the html element using 'class' directive in blade template. The directive accept an array of classes where array key is the name of the class and value should be the boolean expression.
Gurmandeep Singh