لاراول

لاراول 6 از پایه

Laravel 6 From Scratch

In this series, step by step, I'll show you how to build web applications with Laravel 6. We'll start with the basics and incrementally dig deeper and deeper, as we review real-life examples. Once complete, you should have all the tools you need. Let's get to work!

سطح متوسط 54 جلسه آموزشی 04:31:00 ساعت
01
قسمت 1

At a Glance

Before we dig into the nuts and bolts of Laravel, let's first zoom out and discuss what exactly happens when a request comes in.

02
قسمت 2

Install PHP, MySQL and Composer

Before we get started, you must first ensure that up-to-date versions of both PHP and MySQL are installed and available on your machine. In this episode, we'll review how to go about this. Once complete, we can then install Composer.

03
قسمت 3

The Laravel Installer

Now that we have Composer setup, we can pull in the Laravel installer and make it accessible globally on our machine. This allows you to run a single command to build a fresh Laravel installation: laravel new app.

04
قسمت 4

Laravel Valet Setup

If you're a Mac user, rather than running php artisan serve, you might instead choose to install Laravel Valet. Valet is a blazing fast development environment for Laravel that's a cinch to setup.

05
قسمت 5

Basic Routing and Views

When I learn a new framework, the first thing I do is figure out how the framework's default splash page is loaded. Let's work through it together. Our first stop is routes/web.php.

06
قسمت 6

Pass Request Data to Views

The request() helper function can be used to fetch data from any GET or POST request. In this episode, we'll learn how to fetch data from the query-string, pass it to a view, and then encode it to protected against potential XSS attacks.

07
قسمت 7

Route Wildcards

Often, you'll need to construct a route that accepts a wildcard value. For example, when viewing a specific post, part of the URI will need to be unique. In these cases, we can reach for a route wildcard.

08
قسمت 8

Routing to Controllers

It's neat that we can provide a closure to handle any route's logic, however, you might find that for more sizable projects, you'll almost always reach for a dedicated controller instead. Let's learn how in this lesson.

09
قسمت 9

Setup a Database Connection

So far, we've been using a simple array as our data store. This isn't very realistic, so let's learn how to set up a database connection. In this episode, we'll discuss environment variables, configuration files, and the query builder.

10
قسمت 10

Hello Eloquent

In the previous episode, we used the query builder to fetch the relevant post from the database. However, there's a second option we should consider: Eloquent. Not only does an Eloquent class provide the same clean API for querying your database, but...

11
قسمت 11

Migrations 101

In a previous episode, we manually created a database table; however, this doesn't reflect the typical workflow you'll follow in your day-to-day coding. Instead, you'll more typically reach for migration classes. In this episode, we'll discuss what t...

12
قسمت 12

Generate Multiple Files in a Single Command

It can quickly become tedious to generate all the various files you need. "Let's make a model, and now a migration, and now a controller." Instead, we can generate everything we need in a single command. I'll show you how in this episode.

13
قسمت 13

Business Logic

When possible, the code you write should reflect the manner in which you speak about the product in real life. For example, if you run a school and need a way for students to complete assignments, let's work those terms into the code. Perhaps you sho...

14
قسمت 14

Layout Pages

If you review the welcome view that ships with Laravel, it contains the full HTML structure all the way up to the doctype. This is fine for a demo page, but in real life, you'll instead reach for layout files.

15
قسمت 15

Integrate a Site Template

Using the techniques you've learned in the last several episodes, let's integrate a free site template into our Laravel project, called SimpleWork.

16
قسمت 16

Set an Active Menu Link

In this episode, you'll learn how to detect and highlight the current page in your navigation bar. We can use the Request facade for this.

17
قسمت 17

Asset Compilation with Laravel Mix and webpack

Laravel provides a useful tool called Mix - a wrapper around webpack - to assist with asset bundling and compilation. In this episode, I'll show you the basic workflow you'll follow when working on your frontend.

18
قسمت 18

Render Dynamic Data

Let's next learn how to render dynamic data. The "about" page of the site template we're using contains a list of articles. Let's create a model for these, store some records in the database, and then render them dynamically on the page.

19
قسمت 19

Render Dynamic Data: Part 2

Let's finish up this exercise by creating a dedicated page for viewing a full article.

20
قسمت 20

Homework Solutions

Let's review the solution to the homework from the end of the previous episode. To display a list of articles, you'll need to create a matching route, a corresponding controller action, and the view to iterate over the articles and render them on the...

21
قسمت 21

The Seven Restful Controller Actions

There are seven restful controller actions that you should become familiar with. In this episode, we'll review their names and when you would reach for them.

22
قسمت 22

Restful Routing

Now that you're familiar with resourceful controllers, let's switch back to the routing layer and review a RESTful approach for constructing URIs and communicating intent.

23
قسمت 23

Form Handling

Now that you understand resourceful controllers and HTTP verbs, let's build a form to persist a new article.

24
قسمت 24

Forms That Submit PUT Requests

Browsers, at the time of this writing, only recognize GET and POST request types. No problem, though; we can get around this limitation by passing a hidden input along with our request that signals to Laravel which HTTP verb we actually want. Let's r...

25
قسمت 25

Form Validation Essentials

Before we move on to cleaning up the controller, let's first take a moment to review form validation. At the moment, our controller doesn't care what the user types into each input. We assign each provided value to a property and attempt to throw it...

26
قسمت 26

Leverage Route Model Binding

So far. we've been manually fetching a record from the database using a wildcard from the URI. However, Laravel can perform this query for us automatically, thanks to route model binding.

27
قسمت 27

Reduce Duplication

Your next technique is to reduce duplication. If you review our currentArticlesController, we reference request keys in multiple places. Now as it turns out, there's a useful way to reduce this repetition considerably.

28
قسمت 28

Consider Named Routes

Named routes allow you to translate a URI into a variable. This way, if a route changes at some point down the road, all of your links will automatically update, due to the fact that they're referencing the named version of the route rather than the...

29
قسمت 29

Basic Eloquent Relationships

Let's now switch back to Eloquent and begin discussing relationships. For example, if I have a $user instance, how might I fetch all projects that were created by that user? Or if I instead have a $project instance, how would I fetch the user who man...

30
قسمت 30

Understanding Foreign Keys and Database Factories

Let's put our learning from the previous episode to the test. If an article is associated with a user, then we need to add the necessary foreign key and relationship methods. As part of this, though, we'll also quickly review database factories and h...

31
قسمت 31

Many to Many Relationships With Linking Tables

Next up, we have the slightly more confusing "many to many" relationship type. To illustrate this, we'll use the common example of articles and tags. As we'll quickly realize, a third table is necessary in order to associate one article with many tag...

32
قسمت 32

Display All Tags Under Each Article

Now that we've learned how to construct many-to-many relationships, we can finally display all tags for each article on the page. Additionally, we can now filter all articles by tag.

33
قسمت 33

Attach and Validate Many-to-Many Inserts

We now understand how to fetch and display records from a linking table. Let's next learn how to perform inserts. We can leverage the attach() and detach() methods to insert one or many records at once. However, we should also perform the necessary v...

34
قسمت 34

ساخت سریع سامانه ثبت نام

Thanks to the first-party package, Laravel UI, you can easily scaffold a full registration system that includes sign ups, session handling, password resets, email confirmations, and more. And the best part is you can knock out this tedious and common...

35
قسمت 35

روند بازیابی کلمه عبور

In this episode, we'll discuss the basic password reset flow. If a user forgets their password, a series of actions need to take place: they request a reset; we prepare a unique token and associate it with their account; we fire off an email to the u...

36
قسمت 36

Collections

Our first core concept is collection chaining. As you've surely learned by now, when fetching multiple records from a database, a Collection instance is returned. Not only does this object serve as a wrapper around your result set, but it also provid...

37
قسمت 37

حملات CSRF به همراه نمونه

Laravel provides Cross-Site Request Forgery (CSRF) protection out of the box, but you still may not know exactly what that means. In this lesson, I'll show you a few examples of how a CSRF attack is executed, as well as how Laravel protects your appl...

38
قسمت 38

اصول Service Container

Laravel's service container is one of the core pillars of the entire framework. Before we review the real implementation, let's first take a few moments to build a simple service container from scratch. This will give you an instant understanding of...

39
قسمت 39

پیدا کردن خودکار وابستگی ها

Now that you understand the basics of a service container, let's switch over to Laravel's implementation. As you'll see, in addition to the basics, it can also, in some cases, automatically construct objects for you. This means you can "ask" for what...

40
قسمت 40

Laravel Facades Demystified

Now that you have a basic understanding of the service container, we can finally move on to Laravel facades, which provide a convenient static interface to all of the framework's underlying components. In this lesson, we'll review the basic structure...

41
قسمت 41

Service Provider ها، قطعات گمشده

We've spent the last two episodes reviewing Laravel's service container and facades. All of that work is about to pay off, as we move on to service providers. A service provider is a location to register bindings into the container and to configure y...

42
قسمت 42

ارسال ایمیل خام

The easiest way to send an email in Laravel is with the Mail::raw() method. In this lesson, we'll learn how to submit a form, read a provided email address from the request, and then fire off an email to the person.

43
قسمت 43

شبیه سازی صندوق ایمیل با Mailtrap

It's useful to view a log of any mail that is sent while in development mode, but let's switch over to using Mailtrap. This will allow us to simulate a real-life email inbox, which will be especially useful once we begin sending HTML email.

44
قسمت 44

ارسال ایمیل با استفاده از کلاس Mailable

So far, we've only managed to send a basic plain-text email. Let's upgrade to a full HTML-driven email by leveraging Laravel's mailable classes.

45
قسمت 45

ارسال ایمیل با استفاده از قالب های Markdown

We can alternatively write emails using Markdown! In this lesson, you'll learn how to send nicely formatted emails constructed by the framework. For the cases when you need to tweak the underlying HTML structure, we'll also publish the mailable asset...

46
قسمت 46

مقایسه Notifications و Mailables

So far in this chapter, we've exclusively reached for Mailable classes to send emails; however, there's an alternative approach that you might consider as well. A Notification class can be used to notify a user in response to some action they took on...

47
قسمت 47

Database Notifications

A notification may be dispatched through any number of "channels." Perhaps a particular notification should alert the user via email and through the website. Sure, no problem! Let's learn how in this episode.

48
قسمت 48

ارسال SMS در 5 دقیقه

Here's a fun exercise. For this next notification channel, we'll choose one that I've personally never used: SMS messaging. As you'll see, even with no prior experience, it's still laughably simple to conditionally fire off text messages to the users...

49
قسمت 49

رویدادها، مزایا و معایب

Events offer a way for one part of your application to make an announcement that ripples through the entire system. In this episode, we'll not only review the essentials, but we'll also discuss the pros and cons to this particular approach to structu...

50
قسمت 50

محدو کردن دسترسی برای کاربران احراز صلاحیت شده

For any typical web application, some actions should be limited to authorized users. Perhaps only the creator of a conversation may select which reply best answered their question. If this is the case, we'll need to write the necessary authorization...

51
قسمت 51

فیلتر های احراز صلاحیت

There will almost certainly be users in your application who should receive special privileges and access. As examples, consider a forum moderator or site administrator. In these cases, we can declare before and after authorizations filters before th...

52
قسمت 52

تشخیص خودکار نام قابلیت

Here's an optional feature that you might consider. If you exclude the ability name when authorizing from your controllers, Laravel will do it's best to guess the appropriate policy method to call. It does so by creating a map for the typical restful...

53
قسمت 53

احراز صلاحیت با استفاده از Middleware

If you'd prefer not to execute authorization from within your controller actions, you can instead handle it as a route-specific middleware. I'll show you how in this episode.

54
قسمت 54

نقش ها و قابلیت ها

Let's take things up a notch. Beginning with a fresh Laravel installation, let's build a full role-based authorization system that allows us to dynamically grant and revoke various abilities on a per-user basis. View the source code for this episode...

دوره در حال اجرا

این دوره هنوز به پایان نرسیده است و در آینده درس های دیگری به آن افزوده خواهد شد.