Laravel From Scratch
Are you hoping to level up your toolset? You’ve come to the right place. This series will take you from installing Laravel, all the way up to mastering the essentials of the framework.
The first step, of course, is to install Laravel on our machine. We’ll do that installing Composer, pulling in Laravel’s helpful installer utility, and then running laravel new project to generate the project.
Your First View and Route
The “hello world” for frameworks is to figure out how to process a given URI, and display the appropriate HTML on the page.
View Data and Blade
You’ll frequently need to pass data to your views. While figuring out how to accomplish this, you’ll also get your first peek at Laravel’s templating engine, called Blade.
Routing to Controllers
Using route closures is very useful for small projects that don’t require too much functionality.
To reduce duplication, Laravel’s templating engine, Blade, provides what we call “layout files.” Within these files, we can define the wrapping HTML, which nests the content from each of your views.
How to Manage Your CSS and JS
We’ve arrived at the fun part. You’ll first learn how to create migrations to build up your database tables. Next, we’ll use the query builder and Eloquent to fetch data, and render it in the view.
Defining Relationships With Eloquent
Eloquent provides a beautiful mechanism for referencing relationships. For example, a comment belongs to a post, a card can have many notes, and an article can both belong to and have many tags. Let’s demonstrate the basic workflow for creating these relationships today.
Let’s review the basic workflow for submitting a form, fetching the data that was sent through, and then creating a record in the database.
Updating Records and Eager Loading
You’ll of course need to modify existing records in the database. Let’s review the process of creating an “edit” page to handle this very task. Along the way, we’ll also get a chance to review PATCH requests and the concept of eager loading and the problems it solves.
Validation and More
The core topic for this lesson is validation, however, as you’ll find, we’ll also tackle a number of little things: group middleware, CSRF, old input, and more.
Authenticate Your Users
Most applications will require some form of authentication. With Laravel, it genuinely could not be simpler. Let’s setup registration, authentication, and password resets in a matter of minutes.
Think of middleware as layers of an onion. To get through to the core of your application, a request must first pass through these various layers. Perhaps one layer determines if the application is in maintenance mode. Another layer, or middleware, might verify that the user is signed in as an administrator.
Flashing to the Session
You get to learn about session handling today. Specifically, we’ll figure out how to flash notification messages to the session. This way, we can send quick alerts to the user that only exist for a single request.
Automatic Resolution and the Service Container
It’s vital that you fully understand this next topic. In many ways, the service container is the heart of Laravel. A proper understanding is paramount to your success with Laravel.
Bootstrapping With Service Providers
Service providers, though a bit confusing at first, offer a mechanism for any component to register itself with Laravel. Whether you’re bootstrapping a custom package, or simply registering a series of events listeners, it all takes place in a service provider.
In this final review, we’ll do a final sweep over Laravel’s directory structure, and review what we’ve learned. Naturally, there’s so much more to cover
Please Like, Share, Comment and Subscribe for more videos and updates