Table of Contents

The book is broken into 12 chapters, each of which is briefly described below.

Chapter 1. Introducing Laravel

In this opening chapter you'll learn how to create and configure your Laravel project using your existing PHP development environment, a virtual machine known as Laravel Homestead, and a minimal development environment known as Valet (OSX users only). I'll also show you how to configure your environment in order to effectively debug your Laravel applications, and how to extend Laravel's capabilities by installing several popular third-party packages. We'll conclude the chapter with an introduction to PHPUnit, showing you how to create and execute your first automated Laravel test!

Chapter 2. Managing Your Project Controllers, Layout, Views, and Other Assets

In this chapter you'll learn how to create controllers and actions, and define the routes used to access your application endpoints. You'll also learn how to create the pages (views), work with variable data and logic using the Blade templating engine, and reduce redundancy using layouts and view helpers. I'll also introduce Laravel Mix, a new feature for automating otherwise laborious tasks such as JavaScript transpiling and CSS minification. You'll also learn how to integrate several popular CSS frameworks, including Bootstrap 3 and 4, and Tailwind, and how to use Laravel Dusk for integration testing.

Chapter 3. Talking to the Database

In this chapter we'll turn our attention to the project's data. You'll learn how to integrate and configure the database, manage your database schema using migrations, and easily populate your database using seeds. From there we'll move on to creating models, and how to query the database through these models using the Eloquent object relational mapper. I'll also introduce the concept of resourceful controllers, and we'll generate a controller which will be used to view and manage the example project's events. You'll also learn how how to use Laravel's Query Builder to query the database when Eloquent isn't possible or practical.

Chapter 4. Customizing Your Models

Laravel models are incredibly powerful tools, and can be customized in a variety of ways to meet your project's specific needs. In this chapter you'll learn how to override model defaults to create custom accessors and mutators, add instance methods, and use scopes to easily filter database results with minimal code redundancy. You'll also learn how to create sluggable URLs using the eloquent-sluggable package. The chapter concludes with an introduction to testing your models using Laravel's amazing database-specific test features.

Chapter 5. Creating, Updating, and Deleting Data

The last two chapters were primarily focused upon the many different ways you can query the database. In this chapter we'll turn our attention to creating, updating, and deleting data. In addition to a review of the Eloquent syntax used to perform these tasks, we'll continue building out the resourceful controller created in chapter 3. You'll also learn how to incorporate flash notifications into your controllers and views to keep users updated regarding request outcomes, and how to use Laravel Dusk to test your forms.

Chapter 6. Validating User Input

For reasons of simplicity, the last chapter focused exclusively on what it must be like to leave in a world in which error prone or malicious users didn't exist. That is to say I momentarily punted on the matter of user input validation. But data validation is so crucial to successful web application development that it can be put off no longer, and so this chapter is devoted entirely to the topic. In this chapter you'll learn all about Laravel's native validators, and how to incorporate form requests into your project to add form validation while ensuring your controller code remains lean.

Chapter 7. Creating and Managing Model Relationships

Building and navigating table relations is an standard part of the development process even when working on the most unambitious of projects, yet this task is often painful when working with many web frameworks. Fortunately, using Laravel it's easy to define and traverse these relations. In this chapter I'll show you how to define, manage, and interact with one-to-one, one-to-many, many-to-many, has many through, and polymorphic relations.

Chapter 8. Sending E-mails

Whether for requiring newly registered users to confirm their e-mail address, or notifying event attendees of scheduling changes, web applications such as HackerPair rely heavily on using e-mail as an efficient means of communication. In this chapter you'll learn about Laravel's `Mailable` class, a fantastic solution for generating e-mails within your application. You'll also learn how to test e-mail generation and delivery in a sane fashion. Just for added measure, I'll walk you through the steps I took to incorporate a contact form into HackerPair which when submitted sends inquiring users' messages and contact details to a support address.

Chapter 9. Authenticating and Managing Your Users

Most modern applications offer user registration and preference management features in order to provide customized, persisted content and settings. In this chapter you'll learn how to integrate user registration, login, and account management capabilities into your Laravel application. I'll also show you to to add social authentication to your application, allowing users to authenticate using a variety of popular OAuth providers such as Twitter, Facebook, and GitHub.

Chapter 10. Creating an Administration Console

Most web applications incorporate a restricted administration console accessible by the project developers and support team. In this chapter I'll show you an easy solution for designating certain users as administrators, and how to grant access to a restricted console using prefixed route grouping and custom middleware.

Chapter 11. Introducing Vue.js

Vue.js has become the Laravel community's de facto JavaScript library, and for good reason; it shares many of the practical, productive attributes Laravel developers have come to love. Chapter 11 introduces Vue.js' fundamental features, and shows you how to integrate highly interactive and eye-appealing interfaces into your Laravel application.

Chapter 12. Creating an Application API

These days a web interface is often only one of several available vehicles for interacting with the underlying data. Popular services such as GitHub, Amazon, and Google also offer an API (Application Programming Interface) which allow enterprising developers to dream up and implement new ways to view, mine, and update these companies' vast data stores. In this chapter you'll learn how to create your own API, and provide registered users with an API key which they'll use to authenticate when interacting with the API.