Laravel: Code Smart
Laravel: Code Smart
The Laravel Framework Version 5 for Beginners
About the Book
Laravel: Code Smart is the third installment in my 'Code' series of books for the Laravel framework. The 'Code' books have thousands of readers and are considered by many to be the most effective method of learning the Laravel framework. As always, my books serve as both an introduction for beginners, and reference material for more experienced developers. I promise that you're going to love it! You'll be writing Laravel applications in no time.
Features
Code Smart is the true evolution of the 'Code' series. Here are some of the new features.
- Full support for Laravel 5.
- Revamped code examples, with improved highlighting.
- Existing content from Code Bright is refreshed for the new generation of Laravel.
- Code samples now adhere to the PSR-2 coding standard, and use modern PHP features.
- Spelling and grammar have improved tenfold!
- Entirely new introductory and installation chapters. It's now much easier to get started.
- Get started using 'Homestead' to be up and running with Laravel in no time at all.
- A bunch of extra hints and tips scattered throughout the chapters.
- Free beer.
Launch Content
Code Smart will launch with existing Code Bright content revamped, new Laravel 5 chapters, and almost 400 pages. Then it will grow on a weekly basis to become the biggest and greatest resource for learning the Laravel framework. I'm committed to writing at least one new chapter a week. You can vote for the new chapters, by tweeting with the hashtag #codesmart.
Direct Contact
If you find any topic confusing, would like something explained in a different way, or would like something added to the book, simply email me! We'll work together to make Code Smart the number one book for the Laravel framework.
Oh. By the way. Did I mention that there are pandas? There are loads of pandas! Buy it now!
Seriously, though. If you decide to buy Code Smart, then you'll be supporting my future career as a technical author. Thanks to each and every one of you.
Bundles that include this book
Reader Testimonials

Taylor Otwell
Creator, Laravel PHP Framework.
Dayle Rees has been a central figure in the Laravel community for a long time. He's well known not only for his knowledge of the framework, but also his friendly attitude and keen ability to explain Laravel concepts to beginners. There are few people as qualified as Dayle to write a thorough introduction to the Laravel framework.

Eric Barnes
Editor, Laravel News
Dayle Rees is one of the first Laravel developers I met when I started with the framework. His last book, Code Bright, was instrumental in bringing Laravel to a larger audience and his new one does not disappoint. Dayle’s writing has a ton of personality and guaranteed to keep you interested from the first sentence to the last.

James Tyner
Recently educated Laravel expert.
Dayle Rees takes the sometimes dry subject of learning and makes it fun. But its not all fun and games you will learn a ton. along the way Of the many available books on Laravel his are at the top of the list, I own them all.
Sami Fiaz
Laravel Enthusiast
The approach Dayle uses in his writing, for the least, won't let you scare from all those technical terms and concepts. That's _really_ important, especially for someone who is learning something for the first time. Really, there is a lot of laravel stuff out there, but one of the main reason people waiting for his book is probably the way he keeps things simple to understand and keep your interest throughout. Such a pleasure to read!

Peter Steenbergen
Laravel Enthusiast
All the released books of Dayle have a high detail on code explanation. I read every letter of all the Laravel books and still use it as a reference.

Dan Hanly
From the Valleys
Dayle has a writing style that makes complicated subjects seem really quite simple. His books are among the most accessible tech books I’ve ever read. Can I have my £20 now, Dayle?

Orlando Valverde
Laravel Enthusiast
Why read books written by Dayle Rees? His playful and experienced writing; it's a refreshing turnaround from other programming books. Reading his publications are a true joy for beginners who want to experience learning something new at steady pace, in a welcoming voice.
Phillipp Ohlandt
Laravel Enthusiast
Dayle's books are the best I know for learning new things. His humor combined with his talent to explain things very easy is also an awesome experience for people with less English skills. It's a joy to read his books.

David Ives
CTO, Crowdcube.
Reading one of Dayle's books is like having Laravel explained to you by your mate while enjoying a beer. It feels like a conversation that leaves you fired up and ready to get creative. The books are so well paced that you never feel out of your depth or patronised. The subject is explained thoroughly in an entertaining way that makes returning for reference akin to rewatching your favourite movie!
Table of Contents
- Acknowledgements
- Errata
- Feedback
- Translations
-
How to read this book
- Beginners
- Experienced
- Updates
- Changes
- I Introduction
-
II Installation
- 1. Install Software Dependencies
- 2. Create a Laravel Project
- 3. Install Homestead
- 4. Mastering Vagrant
-
III Valet
- 5. Installation
- 6. Adding Sites
- 7. Valet Commands
- 8. Sharing
-
IV Lifecycle
- 9. Request
- 10. Services
- 11. Routing
- 12. Logic
- 13. Response
-
V Namespaces
- 14. Global Namespace
- 15. Simple Name-spacing
- 16. The Theory of Relativity
- 17. Structure
- 18. Limitations
-
VI JSON
- 19. What is JSON?
- 20. JSON Syntax
- 21. JSON and PHP
-
VII Composer
- 22. Configuration
- 23. Dependency Management
- 24. Auto Loading
- 25. Installation
- 26. Usage
-
VIII Configuration
- 27. Configuration Files
- 28. Environmental Variables
- 29. Configuration Caching
-
IX Basic Routing
- 30. Defining Routes
- 31. Route Parameters
-
X Responses
- 32. Views
- 33. View Data
- 34. Redirects
- 35. Custom Responses
-
XI Blade Templates
- 36. Building Templates
- 37. Processing PHP
- 38. Control Structures
- 39. Template Inclusion
- 40. Template Inheritance
- 41. Comments
- 42. Javascript Support
-
XII Request Data
- 43. Retrieval
- 44. Old Input
- 45. Uploaded Files
- 46. Cookies
-
XIII Facades
- 47. What is a Facade?
- 48. How do they work?
-
XIV Advanced Routing
- 49. Named Routes
- 50. Parameter Constraints
- 51. Route Groups
- 52. Route Prefixing
- 53. Domain Routing
-
XV Controllers
- 54. Creating Controllers
- 55. Controller Routing
- 56. Resource Controllers
- 57. Dependency Injection
- 58. Route Caching
-
XVI URL Generation
- 59. The current URL
- 60. Generating Route URLs
- 61. Asset URLs
-
XVII Databases
- 62. Abstraction
- 63. Configuration
- 64. Preparing
-
XVIII Schema Builder
- 65. Creating Tables
- 66. Column Types
- 67. Special Column Types
- 68. Column Modifiers
- 69. Updating Tables
- 70. Dropping Tables
- 71. Schema Tricks
-
XIX Migrations
- 72. Basic Concept
- 73. Creating Migrations
- 74. Running Migrations
- 75. Rolling Back
- 76. Migration Tricks
-
XX Eloquent ORM
- 77. Creating new models.
- 78. Reading Existing Models
- 79. Updating Existing Models
- 80. Deleting Existing Models
-
XXI Eloquent Queries
- 81. Preparation
- 82. Eloquent To String
- 83. Query Structure
- 84. Fetch Methods
- 85. Query Constraints
- 86. Magic Where Queries
- 87. Query Scopes
-
XXII Eloquent Collections
- 88. The Collection Class
- 89. Collection Methods
- 90. Best Practice
-
XXIII Eloquent Relationships
- 91. Implementing Relationships
- 92. Relating and Querying
-
XXIV Validation
- 93. Simple Validation
- 94. Validation Rules
- 95. Error Messages
- 96. Custom Validation Rules
- 97. Custom Validation Messages
-
XXV Events
- 98. Concept
- 99. Firing Events
- 100. Listening for Events
- 101. Event Subscribers
- 102. Global Events
- 103. Use Cases
-
XXVI Dependency Injection
- 104. Concept
- 105. Dependency Injection with the Container
- 106. Injection within Controllers
- 107. Injecting Services
- 108. Contracts
-
XXVII Middleware
- 109. Middleware Classes
- 110. Global Middleware
- 111. Route Middleware
- 112. Middleware Parameters
- 113. Middleware Groups
-
XXVIII Service Providers
- 114. Registering Providers
- 115. Writing Providers
- 116. Deferred Providers
-
XXIX The Container
- 117. Useful Terms
- 118. Basic Usage
- 119. Singletons
- 120. Bound Instances
- 121. Class Resolution
- 122. Implementation Binding
- 123. Contextual Binding
- 124. Tagging Bindings
- 125. Resolution Methods
-
XXX Session
- 126. Storing Values
- 127. Retrieving Values
- 128. Removing Values
- 129. Flash Data
- 130. Tips & Tricks
- 131. Configuration
-
XXXI Cache
- 132. Storing Values
- 133. Retrieving Values
- 134. Removing Items
- 135. Tagging Items
- 136. Tips & Shortcuts
- 137. Using Stores
- XXXII Coming Soon
Other books by this author
The Leanpub 60-day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
Do Well. Do Good.
Authors have earned$11,583,453writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Top Books
SignalR on .NET 6 - the Complete Guide
Fiodar SazanavetsLearn everything there is to learn about SignalR and how to integrate it with the latest .NET 6 and C# 10 features. Learn how to connect any type of client to SignalR, including plain WebSocket client. Learn how to build interactive applications that can communicate with each other in real time without making excessive calls.
The easiest way to learn design patterns
Fiodar SazanavetsLearn design patterns in the easiest way possible. You will no longer have to brute-force your way through each one of them while trying to figure out how it works. The book provides a unique methodology that will make your understanding of design patterns stick. It can also be used as a reference book where you can find design patterns in seconds.
Functional event-driven architecture: Powered by Scala 3
Gabriel VolpeExplore the event-driven architecture (EDA) in a purely functional way, mainly powered by Fs2 streams in Scala 3!
Leverage your functional programming skills by designing and writing stateless microservices that scale, powered by stateful message brokers.
Tech Giants in Healthcare
Dr. Bertalan MeskoThis comprehensive guide, Tech Giants in Healthcare, clarifies how and why big tech companies step into healthcare, and breaks it down from one market player to the other in what direction they are going, what tools they are using and what horizons they have in front of them.
OpenIntro Statistics
David Diez, Christopher Barr, Mine Cetinkaya-Rundel, and OpenIntroA complete foundation for Statistics, also serving as a foundation for Data Science.
Leanpub revenue supports OpenIntro (US-based nonprofit) so we can provide free desk copies to teachers interested in using OpenIntro Statistics in the classroom and expand the project to support free textbooks in other subjects.
More resources: openintro.org.
Ansible for DevOps
Jeff GeerlingAnsible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
Recipes for Decoupling
Matthias NobackCCIE Service Provider Version 4 Written and Lab Exam Comprehensive Guide
Nicholas RussoThe service provider landscape has changed rapidly over the past several years. Networking vendors are continuing to propose new standards, techniques, and procedures for overcoming new challenges while concurrently reducing costs and delivering new services. Cisco has recently updated the CCIE Service Provider track to reflect these changes; this book represents the author's personal journey in achieving that certification.
Jetpack Compose internals
Jorge CastilloJetpack Compose is the future of Android UI. Master how it works internally and become a more efficient developer with it. You'll also find it valuable if you are not an Android dev. This book provides all the details to understand how the Compose compiler & runtime work, and how to create a client library using them.
C++20 - The Complete Guide
Nicolai M. JosuttisAll the new language and library features of C++20 (for those who know previous versions).
The book presents all new language and library features of C++20. Learn how this impacts day-to-day programming, to benefit in practice, to combine new features, and to avoid all new traps.
Buy early, pay less, free updates.
Other books:
Top Bundles
- #1
All the Books of The Medical Futurist
6 Books
We put together the most popular books from The Medical Futurist to provide a clear picture about the major trends shaping the future of medicine and healthcare. Digital health technologies, artificial intelligence, the future of 20 medical specialties, big pharma, data privacy, digital health investments and how technology giants such as Amazon... - #2
Practical FP in Scala + Functional event-driven architecture
2 Books
Practical FP in Scala (A hands-on approach) & Functional event-driven architecture, aka FEDA, (Powered by Scala 3), together as a bundle! The content of PFP in Scala is a requirement to understand FEDA so why not take advantage of this bundle!? - #3
CCIE Service Provider Ultimate Study Bundle
2 Books
Piotr Jablonski, Lukasz Bromirski, and Nick Russo have joined forces to deliver the only CCIE Service Provider training resource you'll ever need. This bundle contains a detailed and challenging collection of workbook labs, plus an extensively detailed technical reference guide. All of us have earned the CCIE Service Provider certification... - #5
Software Architecture for Developers: Volumes 1 & 2 - Technical leadership and communication
2 Books
"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before... - #6
Pattern-Oriented Memory Forensics and Malware Detection
2 Books
This training bundle for security engineers and researchers, malware and memory forensics analysts includes two accelerated training courses for Windows memory dump analysis using WinDbg. It is also useful for technical support and escalation engineers who analyze memory dumps from complex software environments and need to check for possible... - #8
Modern C++ Collection
3 Books
Get All about Modern C++C++ Standard Library, including C++20Concurrency with Modern C++, including C++20C++20Each book has about 200 complete code examples. Updates are included. When I update one of the books, you immediately get the updated bundle. You can expect significant updates to each new C++ standard (C++23, C++26, .. ) and also... - #9
Linux Administration Complet
4 Books
Ce lot comprend les quatre volumes du Guide Linux Administration :Linux Administration, Volume 1, Administration fondamentale : Guide pratique de préparation aux examens de certification LPIC 1, Linux Essentials, RHCSA et LFCS. Administration fondamentale. Introduction à Linux. Le Shell. Traitement du texte. Arborescence de fichiers. Sécurité...