Learning Laravel's Eloquent

Develop amazing data-based applications with Eloquent, the Laravel framework ORM

Learning Laravel's Eloquent

Francesco Malatesta

1 customer reviews
Develop amazing data-based applications with Eloquent, the Laravel framework ORM
Mapt Subscription
FREE
$29.99/m after trial
eBook
$16.80
RRP $23.99
Save 29%
Print + eBook
$29.99
RRP $29.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$16.80
$29.99
$29.99p/m after trial
RRP $23.99
RRP $29.99
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Code Files
Preview in Mapt

Book Details

ISBN 139781784391584
Paperback202 pages

Book Description

Learning Laravel's Eloquent starts off by taking you through setting up your first project and guiding you in creating a perfect Laravel environment. You will learn how to build the right database structure with the Migrations system and the Schema Builder class. Next, you will be introduced to the main element of Eloquent: the model. After treating the model as a single, isolated entity, you will learn how to create relations between them. You will be taken through organizing, filtering, and sorting your data with collections. You will then learn to enhance an application with new features using events and by creating new observers. Towards the end of the book, you will discover how to install, configure, and use the Eloquent ORM without Laravel. The book concludes by walking you through how to deal with complex problems and build advanced and flexible systems.

Table of Contents

Chapter 1: Setting Up Our First Project
Your Swiss Army Knife – Composer
Your safe place – Homestead
The new hideout: Homestead improved
A bonus tool – Adminer
Your best friend: Laravel
The first project – EloquentJourney
Summary
Chapter 2: Building the Database with the Schema Builder Class
The Schema Builder class
Database versioning with the migrations system
Summary
Chapter 3: The Most Important Element – the Model!
Creating a Model
Create, read, update, and delete operations basics
where, aggregates, and other utilities
Mass assignment... for the masses
Timestamps and soft deletes
Query scopes
Attributes casting, accessors, and mutators
Descending in the code
Summary
Chapter 4: Exploring the World of Relationships
The trinity – one to one, one to many, many to many
Querying-related models
Eager loading (and the N + 1 problem)
Inserting and updating related models
Accessing distant relationships
More power – polymorphic relationships
Summary
Chapter 5: Using Collections to Enhance Results
Basic collection operations
Transforming collections
Iterating and filtering
Sorting
Summary
Chapter 6: Everything under Control with Events and Observers
When should I use events in my models?
Model events
An example of model events
Events observers
An example of model observers
Summary
Chapter 7: Eloquent… without Laravel!
Exploring the directory structure
Installing and configuring the database package
Using the ORM
Using the Query and Schema Builder
Summary
Chapter 8: It's Not Enough! Extending Eloquent, Advanced Concepts
Extending the Model: Aweloquent!
Diving into the repository pattern
Summary

What You Will Learn

  • Configure a new Laravel project and set up database connections in minutes
  • Build and work with models to handle your data with an expressive syntax
  • Define relations between your models to create complex functionalities
  • Query your database using relations simply
  • Use collections to gather results and perform many operations on them with a powerful data structure
  • Use the Eloquent ORM without Laravel
  • Control your models during the request lifecycle with event listeners and observers

Authors

Table of Contents

Chapter 1: Setting Up Our First Project
Your Swiss Army Knife – Composer
Your safe place – Homestead
The new hideout: Homestead improved
A bonus tool – Adminer
Your best friend: Laravel
The first project – EloquentJourney
Summary
Chapter 2: Building the Database with the Schema Builder Class
The Schema Builder class
Database versioning with the migrations system
Summary
Chapter 3: The Most Important Element – the Model!
Creating a Model
Create, read, update, and delete operations basics
where, aggregates, and other utilities
Mass assignment... for the masses
Timestamps and soft deletes
Query scopes
Attributes casting, accessors, and mutators
Descending in the code
Summary
Chapter 4: Exploring the World of Relationships
The trinity – one to one, one to many, many to many
Querying-related models
Eager loading (and the N + 1 problem)
Inserting and updating related models
Accessing distant relationships
More power – polymorphic relationships
Summary
Chapter 5: Using Collections to Enhance Results
Basic collection operations
Transforming collections
Iterating and filtering
Sorting
Summary
Chapter 6: Everything under Control with Events and Observers
When should I use events in my models?
Model events
An example of model events
Events observers
An example of model observers
Summary
Chapter 7: Eloquent… without Laravel!
Exploring the directory structure
Installing and configuring the database package
Using the ORM
Using the Query and Schema Builder
Summary
Chapter 8: It's Not Enough! Extending Eloquent, Advanced Concepts
Extending the Model: Aweloquent!
Diving into the repository pattern
Summary

Book Details

ISBN 139781784391584
Paperback202 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

Mastering Laravel Book Cover
Mastering Laravel
$ 39.99
$ 28.00
Laravel Application Development Cookbook Book Cover
Laravel Application Development Cookbook
$ 26.99
$ 5.40
Mastering Web Application Development with AngularJS Book Cover
Mastering Web Application Development with AngularJS
$ 26.99
$ 5.40
Laravel Application Development Blueprints Book Cover
Laravel Application Development Blueprints
$ 26.99
$ 18.90
Laravel 5 Essentials Book Cover
Laravel 5 Essentials
$ 23.99
$ 16.80
Laravel Design Patterns and Best Practices Book Cover
Laravel Design Patterns and Best Practices
$ 13.99
$ 9.80