Laravel Pro Tips
#eloquent #relationships
π₯#Laravel #Eloquent Tip: You may not always need every column from the relationships you are retrieving. For this reason, Eloquent allows you to specify which columns of the relationship you would like to retrieve. π https://t.co/RZYbV13yac #Laravel #Code #PHP
Laravel Eloquent
#eloquent #models
πΆοΈ #Laravel tip: Eloquent π³πΆπ»π±() finds a model by its primary key. It can also find a Collection of Models by their primary keys β‘οΈ π¨ππ²πΏ::π³πΆπ»π±([1,2,3]) Let's see some examples π #PHP #Developers #100daysofcodechallenge
Bilal Haidar
#eloquent #datetime
Laravel tip: Use the "{action}_at" naming convention for your DATETIME and TIMESTAMP fields. This helps you to instantly recognise in your code when you're using a datetime field π #laravel #php
Ash Allen π
#collections
π₯ #Laravel Tip: Consider refactoring plain PHP procedural code to use Collections instead. Itβs a great way to clean up your code and makes it much easier to understand.
Matt Kingshott
#eloquent
Laravel tip of the day: you probably know the Eloquent "when" statement to avoid if-else conditions. But did you know it has another parameter, a "fallback" function, which could be translated as "when not" or "else"? See example.
Povilas Korop | Laravel Courses Creator & Youtuber
#services #actions
π‘This is a simple service class. It helps you: - Simplifying your overcomplicated controllers - Extracting out reusable code They can be really useful in smaller projects. π§΅Keep Reading
Martin Joo
#eloquent #sql #query builder
π₯ #Laravel Eloquent Tip - You can use "as" in Eloquent Query Builder to return any column with a new name, exactly like in a regular SQL query.
Marian Pop πΊπ¦ Laravel Magazine
#pagination
πΆοΈ #Laravel tip: When you want to paginate your data results & only show "Next" and "Previous" buttons, you can opt for "simplePaginate()" instead of "paginate()" method. In this case, simplePaginate() is more efficient π #PHP #Developers #100Devs
#eloquent #query builder
π₯ #Laravel Tip: Make use of the βvalueβ method on the query builder to execute a more efficient query when you only need to retrieve a single column.