
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.
Identify and install tools, including Apache, MySQL, and the Zamp package, for Windows, Linux, or Mac OS; set up a code editor (Visual Studio Code) and workspace, and verify localhost.
Configure Apache mod_rewrite to prevent direct access to resources, enable rewrite engine, and redirect unauthorized requests to the base workspace while selectively allowing images and scripts.
Build a PHP autoloading system by defining a root path, creating a core namespace, and loading core\user on demand to resolve class not found errors and use the All method.
Develop a data access layer class in a database namespace that auto connects to MySQL in its constructor, and exposes a query method to execute SQL and return results.
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.
Implement insert, update, and delete methods in the ORM class, returning the number of rows inserted or affected and handling connection errors with exceptions.
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.
Develop and test a command builder that creates a select query for the users table, including a where method with closures for inner conditions and one or three-argument calls.
Implement the orWhere method to add or conditions to a query builder, supporting both a callback form and a three-argument form, and demonstrate building nested age and email filters.
Implement the whereIn method in a Laravel Eloquent style ORM to build queries that select users where name in ('Alex','Daniel') and age in (20,30,40), handling and or conditions and quotes.
Learn to implement a join method in a Laravel Eloquent–style ORM, accepting four arguments and supporting chained joins across users, posts, and comments.
Create get and avg methods in an ORM-like class to fetch data with a select query, convert results to objects, and compute the average age from the users table.
Implements aggregate function methods for the ORM, adding sum, count, mean, and max, and tests these functions against the users table to verify values.
Implement an insert command builder in an ORM, creating single and multi-row inserts for associative and index-based data, with insert and insert get methods, and test with a database.
Develop a delete command within an ORM by implementing the delete command method, applying a condition, executing the delete on the users table, and returning the number of affected rows.
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.
Discover how model and builder classes collaborate to perform table level and object level operations in an ORM, with a base model and a user model, using static methods.
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.
Implement the second set of builder query methods, including offset, limit, join, and aggregate functions (avg, count, min, max), on the model, and prepare test queries.
Implement builder's first find and create methods in Bieler class, rename to get, and use limit and get to fetch a single record, inserting data and returning the new object.
Implement builder mass update and mass delete methods in the model, show deleting and updating multiple users using static methods on the model class.
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.
Implement a safe, single model save method that creates new user records or updates existing ones, filtering out non-column data and using table columns to perform insert or update.
Explore modeling database-like relationships in an application by defining one-to-many, many-to-many, and one-to-one relations between models; implement a has-many relation in a dedicated relations namespace with an abstract base class.
Create a posts table and define a one-to-many relationship to users with a user_id foreign key and cascade on delete, then populate posts for Daniel and Alex.
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.
Learn to implement a belongs to relation in laravel-like orm by creating a relation class and a user() method returning a belongs to instance, mapping post.user_id to users primary key.
Create profiles table to support a one-to-one relationship with users. Use id as both primary and foreign key to users.id, include country and city, with on delete cascade.
Create a hasOne relation to model a one-to-one link between users and profiles, and implement the initiateConnection method to access the related profile from a user.
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 eagle loading of related data by passing an array of relations, each either a name or a closure with constraints, enabling loading of profile and posts.
Implement the get method of the builder to eager-load relational data by iterating over relations, building relation queries, fetching related records, and preparing to distribute them across main data.
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 has many and belongs to relations abstract methods by building relation data queries, adding relation data, and loading related models like user and profile.
Learn to design a ratings table for a Laravel-style ORM, linking users and posts with a 1–5 rating, enforcing unique user-post ratings and foreign keys, and fix prior model issues.
Define a belongs to many relationship in an eloquent model by implementing the rated posts method, configuring the pivot ratings table, and wiring the user and post models.
Implement the initiateConnection method by validating the reference model, signaling the connection, and building a relational data query via joins that link the relation table to posts and users.
Implement the buildRelationDataQuery method to construct a relation data query that loads a user’s related posts by linking posts, ratings, and users via a belongs-to relation.
Learn to extend an orm like Laravel Eloquent by adding pivot table columns to relation data, joining users, posts, and ratings to reveal who rated which post.
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.
Implement the detach method to remove rating associations for a user from the ratings pivot table, using the array of related primary keys.
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.