This video requires a TekCasts subscription.

Available to all subscribers with an active plan.

Dec 9, 2025
23m:21s

Eloquent ORM

Classification
Software Engineering | Frameworks | Laravel
Keywords
laravel | php

About This Episode:

In this episode, we move from raw query building into Laravel’s Eloquent ORM — an elegant way to interact with your database using PHP objects instead of SQL queries.

Eloquent simplifies data access, manages relationships automatically, and helps keep your code clean, readable, and expressive.

🔍 In this video, you’ll learn how to:
- Create Eloquent models for your tables
- Define relationships between surveys, sections, and questions
- Replace complex Query Builder logic with elegant model relationships
- Use eager loading with with() for efficient database queries
- Leverage attribute casting for arrays and enums

💡 You’ll see how Eloquent turns your data model into a first-class part of your application — paving the way for true MVC architecture in upcoming episodes.

🧠 Key Commands
- php artisan make:model Survey
- php artisan make:model SurveySection
- php artisan make:model SurveyQuestion

🔗 Resources
- Eloquent ORM Documentation: https://laravel.com/docs/12.x/eloquent
- TekCasts – Database Model Abstractions: https://tekcasts.com/play/pragmatic-php-database-model-abstractions
- TekCasts – GitHub Repo (Rate This Pic): https://github.com/rcravens/rate_this_pic/blob/master/app/Framework/Model.php

💥 About the Series:
Pragmatic Laravel focuses on building real applications with Laravel — emphasizing clarity, maintainability, and thoughtful design decisions instead of shortcuts or magic.

#Laravel #Eloquent #PHP #WebDevelopment #LaravelTutorial #FullStack #TekCasts #CodeBetter #DevTips #LaravelForDevelopers
Bob Cravens

Bob Cravens

Owner
TekFoundry
Wisconsin
United States
Short Bio:
Bob Cravens is a seasoned technology leader, software architect, and educator with a passion for empowering others through practical, real-world knowledge. As the founder of TekFoundry, Bob has dedicated his career to designing and delivering innovative software solutions that combine cutting-edge technology with elegant simplicity.

At TekCasts, Bob leverages over two decades of experience in software engineering, application architecture, and team leadership to create engaging, high-impact courses for developers and technology professionals. His instructional style is rooted in practical application, offering insights drawn from his extensive background in industries like medical devices and global technology consulting.

Bob’s expertise spans a variety of technologies and methodologies, including PHP/Laravel, FastAPI, and DevOps, as well as architecture best practices and team dynamics. Whether teaching foundational concepts or advanced strategies, he’s passionate about helping others turn complex challenges into streamlined solutions.

When not crafting elegant code or inspiring the next generation of tech innovators, Bob enjoys exploring the intersection of technology, business strategy, and creative problem-solving.