Cheat Sheet for Eloquent – ORM in Laravel
Eloquent is an ORM framework which is used in Laravel to make web development easier and faster by focusing on object-oriented approach rather than writing plain SQL queries.
Eloquent ORM in Laravel: How Does It Work?
Eloquent ORM offers an ActiveRecord implementation for database to work with, which means that every model created in MVC structure resembles to a table of the database.
Ordering Eloquent hasMany() relationship
Add ->orderBy() to the hasMany relationship to get ordered output of a specified column.
Eloquent’s where() method
Prevent Eloquent from adding created_at or updated_at timestamps
Disable both created_at and updated_at timestamps
restore() soft deleted Eloquent
To Use the restore() method to undelete a record.
Joins in Eloquent
cheat sheet for eloquent’s join() method
primary key or throw an exception if it’s not available.
Cache in Eloquent
Retrieve an item from the cache without loading it all the item.
If you need an Well experienced Laravel development company, trust out experts at Intertoons! We provide Develoment ,Hosting, And Social Media Promotion , and can do other related tasks including the webpage design of your Laravel based project. Contact us today!intertoons.com
October 13, 2021