Book Title ....1
Inner title ....3
Copyright....4
Dedicated Page ....5
About the Author....6
About the Technical Reviewer....7
Acknowledgements....8
Preface....9
Downloading the codebundles and colored images....11
PIRACY Page ....12
Table of Contents....13
Chapter 1: Getting Startedwith Laravel....24
Introduction....24
Structure....24
Introduction to Laravel....25
Preference for Laravel....25
Scalable....25
MVC Architecture....25
Community....26
Class Dependency Management....26
Eloquent ORM....26
Unique Features of Laravel....28
Database Seeding....28
Localization....29
Latest Version Release Changes....31
How to Upgrade....31
Dependencies....31
Minimum Stability....32
Public Path Binding....32
Redis Cache Tags....33
Database Expressions....33
Eloquent....33
Testing....34
Installation and Setup of LaravelDevelopment Environment....34
Installing PHP....34
Mac....34
Windows....35
Installing Composer....37
Mac....37
Windows....39
Installing Laravel....40
Laravel Artisan....41
Core Concept....47
Conclusion....48
Chapter 2: MVC Architecturein Laravel....49
Introduction....49
Structure....49
Overview of MVC Architecture....49
History....50
Separation of Components....50
MVC Architecture Pattern in the Context of Laravel....51
Design Principles....52
Reusability....52
Flexibility....52
Cohesion....52
Coupling....53
Design Independence in Components....53
MVC in Laravel....53
Key Features....54
SEO Friendly....54
Importance of SEO....54
Principles....54
Test Driven Development....55
Simultaneous Development....55
Maintainability and Extensibility....55
Models in Laravel....56
Views in Laravel....56
Controllers in Laravel....57
Conclusion....57
Chapter 3: Routers and Viewsin Laravel....59
Introduction....59
Structure....59
Routers in Laravel....60
Introduction to Routers....60
Routes Directory....61
Router Methods....62
Types of Routers....62
Redirect Routes....63
View Routes....63
The Route List....63
Fallback Routes....64
Route Parameters....64
Optional Parameters....65
Regular Expressions Constraints....66
Regular Expressions....66
Regular Expressions Constraints....68
Route Groups....69
Middleware....70
Controllers....71
Subdomain Routing....72
Route Prefixes....72
Cross-origin Resource Sharing (CORS)....73
Caching....74
Views in Laravel....74
Creating Views....75
Views and View Extensions....76
Nested Views Directories....76
First Available View....76
Data and Views....77
Sharing Data....78
View Composers and Creators....79
View Composers....79
Multiple Views with Composer....82
View Creators....83
View Optimization....83
Conclusion....84
Points to Remember....85
Chapter 4: Building Controllers and Blade Templates....86
Introduction....86
Structure....86
Controllers with Views in Laravel....87
Controllers....87
Resource Controllers....88
Constructor Injection....90
Method Injection....91
Redirects in Laravel....92
Redirect Helper....92
Redirecting to Named Routes....92
Redirecting to Controller Actions....93
Redirecting - Flashed Session Data....93
Directives in Laravel....94
Conditional Directives....95
Custom if Statements....96
Switch Directive....96
Auth Directive....97
Loops....99
Once Directive....101
Blade as Template Engines in Laravel....102
Data in Blade....102
HTML Entity Encoding....103
Components....104
Rendering Components....105
Passing Data....106
Layouts....107
Template Inheritance....108
Rendering Blade Templates....109
Rendering Blade Fragments....110
Conclusion....111
Points to Remember....111
Chapter 5: Working with Eloquent ORM and Query Builder....113
Introduction....113
Structure....113
Eloquent in Laravel....114
Database Migrations....115
Primary Key....116
Timestamps....117
Eloquent Events....118
Query Builder in Laravel....120
Selects....120
Joins....122
Left Join....122
Advanced Joins....123
Advanced Where....123
Aggregates....124
Raw Expressions....124
Pessimistic Locking....125
Caching Queries....125
Eloquent Operations....125
Model Classes....126
Model Conventions....127
Table Name....128
Primary Key....128
UUID and ULID Keys....131
Database Connections....133
Retrieving Models....133
Collections....134
Chunking Results....135
Chunk Using Lazy Collections....136
Cursors....137
Advanced Subqueries....138
CRUD Operations on Models....139
Events....141
Conclusion....143
Points to Remember....144
Chapter 6: Implementing Authentication and Authorization in Laravel....145
Introduction....145
Structure....145
Laravel’s built-in Authentication System....146
Laravel API Authentication Services....147
Passport....147
Sanctum....148
Customizing Authentication andRegistration logic....148
HTTP Authentication....148
Stateless HTTP Authentication....149
Custom User Providers....150
User Provider Contract....152
Authenticatable Contract....154
Implementing Authorization Policies and Gates....155
Invalidating User Sessions....156
Password Management....157
Configuration....157
Routing....157
Authentication Custom Guards....159
Closure Request Guards....160
Invalidate Sessions across Multiple Devices....162
User Session Knowledge....163
Additional Authentication Methods....163
Authenticate a User Instance....164
Authenticate a User By ID....165
Authenticate a User Once....165
Securing Routes and Actions withMiddleware....165
Middleware....166
Assigning Middleware To Routes....169
Middleware Groups....171
Sorting Middleware....173
Middleware Parameters....174
Terminable Middleware....175
Conclusion....177
Points to Remember....178
Chapter 7: Developing APIs with Laravel....179
Introduction....179
Structure....179
Understanding APIs, REST....180
REST....180
SOAP....180
Resources, Collections and NestingRelationships....180
Writing Resource....184
Relationships....185
Data Wrapping....186
Understanding Data Wrapping....188
Conditional Relationships....190
Resource Response....192
Laravel Passport....193
Installing and Setup....194
Configuration....195
Token Lifetimes....195
Overriding Default Models....196
Overriding Routes....197
Access Tokens....198
Client....198
JSON API....199
GET....199
POST....200
PUT....200
DELETE....201
Protecting Routes....201
Middleware....202
Access Token....203
Token Scopes....203
Defining a scope....203
Default Scope....204
Check Scope....205
Conclusion....206
Points to Remember....207
Chapter 8: Testing and Debugging your Laravel Application....208
Introduction....208
Structure....208
Introduction to Testing in Laravel....209
Setting up Environment for Testing....209
Testing Lifecycle....210
Creating Tests....210
Running Tests....212
Parallel Execution of Tests....212
Reporting....215
HTTP Tests....216
Make a Request....216
Customizing Request Headers....217
Cookies....218
Authentication....219
Debugging Responses....221
Exception Handling....223
File Upload Testing....223
Debugging in Laravel....225
Conclusion....226
Points to Remember....227
Chapter 9: E-mail and Notifications in Laravel....228
Introduction....228
Structure....228
Generating Notifications....229
Sending Notifications....229
Delivery Channels....230
Queuing Notifications....231
Delaying Notifications....232
Custom Notification Queue....233
Custom Notification Channel Queue....234
On-Demand Notifications....236
Mail Notifications....237
Customizing Email Components....238
Custom templates....240
Handling Raw Data....242
Tags and Metadata....243
Custom Symfony Message....244
Broadcast Notifications....244
Notification Events....247
Conclusion....249
Points to Remember....250
Chapter 10: Deploying your Laravel Appto Cloud....252
Introduction....252
Structure....252
Cloud Deployment Fundamentals....253
Cloud Providers Overview....254
Amazon Web Services....254
Heroku....255
Google Cloud....255
Laravel Application Deployment withVapor....256
Installation....256
Installing the Vapor Core....257
Installing the Vapor Dashboard....257
Dashboard Authorization....258
Environment....258
Deployment....262
Hooks....262
Development....264
Configure OpenSSL....264
Domains....267
DNS Records....268
Custom Records....268
SSL Certificates....269
Add Domain to Environment....269
Troubleshooting....272
Conclusion....273
Points to Remember....274
Index....275
A....275
B....276
C....276
D....276
E....277
F....277
G....277
H....277
I....278
J....278
L....278
M....279
N....279
O....279
P....279
Q....280
R....280
S....281
T....281
U....281
V....281
W....282
Back title....284
The "Ultimate Laravel for Modern Web Development" is a comprehensive journey through Laravel, the PHP framework revolutionizing web development. This practical guide ensures a fluid progression from fundamentals to advanced techniques, making you a seasoned Laravel expert. The book begins with the fundamentals, seamlessly transitioning into the core of Laravel's MVC architecture. It then navigates through routers, views, controllers, and Blade templates, building a strong foundation for your projects.
As you progress, the book will uncover the power of Eloquent ORM and Query Builder, mastering efficient data handling. You will implement seamless authentication and authorization processes to ensure the security of your applications and develop robust APIs to enhance your application's functionality and connectivity.
The book will dive into the art of testing and debugging, refining your Laravel projects for optimal performance. It will delve into email and notifications, adding dynamic communication to your applications. Finally, you will learn the ins and outs of deploying your Laravel app to the cloud, bringing your creations to a global audience.