
Develop a perfect orm with object oriented methods to map models to database tables, perform CRUD operations, and load relational data efficiently using a base model class.
Implement fetch and insertGetId methods to retrieve data from a database table, convert results to the specified class objects, and return the newly inserted id, with error handling.
Transform the class into a singleton to ensure a single database connection by using a private constructor and a public getInstance method, so all files reuse the same object.
Create a command builder class that assembles SQL queries with private fields for table, select, join, where, group by, having, order by, limit, and offset, using getters and setters.
Implement select and buildSelectCommand methods in a Laravel-style ORM, building a query by selecting columns, handling all columns when none chosen, and appending join, group by, having, and other clauses.
Implement the build update command method to construct an update query from data, trim the trailing comma, and support conditional clauses for the update method.
Learn how to build a perfect ORM like Laravel Eloquent by implementing a base model and builder, delegating static calls with __callStatic to fetch all records from a table.
Implement builder query methods to filter users by name and include multiple conditions, while routing static calls to the builder and enabling select queries.
Develop a single model update and delete method in a Laravel Eloquent-style ORM to modify or remove one object by primary key, using a table context and a command builder.
Learn how to implement a one-to-many relation between users and posts using has many and belongs to relations, build relation builders, and perform CRUD operations on related posts.
Test the relation class by loading a user, accessing their posts, and using the relation builder to update a post title and delete all related posts.
Explore lazy loading versus eager loading to optimize database queries, illustrate the N+1 problem with users and posts, and show how eager loading reduces to two queries.
Implement the get method of the Builder class for eager loading by attaching relational data to main data objects and mapping foreign keys to relate users and posts.
Implement the addRelationData method to fetch users and their rated posts in a single query, distributing relational data and building reference models for belongs-to relations.
Learn how to implement an attach method in a many-to-many relation by inserting rows into the ratings pivot table to link a user with posts, including optional rating values.
Fix left problems by changing the relation to belongs to many and ensuring proper table access, and resolve offset syntax by enforcing a default limit in the builder.
If you ever wanted to develop a powerful Object relational mapping system (ORM) and enhance your object oriented skills, then this course helps a lot. Having basic knowledge of object oriented programming, the course is designed for programmers who are tired of writing short and long SQL queries in PHP applications and want to learn how to query database in a structured and optimized way with object oriented classes and methods. This is specially beneficial for beginner Laravel developers who struggle working with Eloquent ORM. Learning how to create a powerful ORM, it will be fairly easy for developers to work with Eloquent or any other ORM. In this course you will learn how to build and execute most complicated queries with classes and methods in PHP without writing long boring SQL queries. We will implement a library of classes that will help us from creating and executing any type of query to optimizing queries and loading complex data and relations. All in details. Course will be updated to introduce more complicated query methods and also execution of a list of complicated queries will be instructed.