لاراول

ساخت اپلیکیشن لاراول با TDD

Build A Laravel App With TDD

It's time to take the techniques we learned in Laravel From Scratch, and put them to good use building your first real-world application. Together, we'll leverage TDD to create Birdboard: a minimal Basecamp-like project management app.

This series will give us a wide range of opportunities to pull up our sleeves and test our Laravel chops. As always, we start from scratch: laravel new birdboard.

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

Meet Birdboard

Let's begin by reviewing the application that we plan to build. We'll then finish up by installing Laravel and performing the first commit.

02
قسمت 2

Let's Begin With a Test

My hope is to demonstrate, as much as possible, my actual workflow when writing my own applications. With that in mind, let's begin with our first feature test.

03
قسمت 3

Testing Request Validation

We haven't yet written any request validation logic. As before, let's use a TDD approach for specifying each validation requirement.

04
قسمت 4

Model Tests

We must next ensure that a user can visit any project page. Though we should start with a feature test, this episode will provide a nice opportunity to pause and drop down a level to a model test.

05
قسمت 5

A Project Requires An Owner

It's true that we can now create and persist projects to the database, but they aren't currently associated with any user. This isn't practical. To fix this, we'll write a test to confirm that the authenticated user is always assigned as the owner of...

06
قسمت 6

Scoping Projects

In this episode, we'll continue tweaking which projects are displayed to the user. We'll also begin implementing the appropriate page authorization.

07
قسمت 7

The Create Project View

We already have the necessary logic to persist new projects, however, we haven't yet created the "create project" page, itself. Let's take care of that quickly in this episode.

08
قسمت 8

Prepping the Frontend

Before I begin writing CSS, we first need to set the stage. We'll begin by pulling in all necessary npm dependencies and configuring Tailwind compilation with Laravel Mix.

09
قسمت 9

Go Go Gadget Tailwind

In this episode, we'll leverage Tailwind to begin constructing the Birdboard UI.

10
قسمت 10

Grid Spacing and Card Tweaks

Let's continue working on the CSS for the projects dashboard. This will give us an opportunity to discuss grid spacing, and how we can use a combination of padding and negative margins to perfectly align our columns.

11
قسمت 11

Styling the Project Page

Before we jump back to PHP, let's write one more lesson's worth of CSS. Specifically, we'll get the single project page up and running.

12
قسمت 12

A Project Can Have Tasks

We've added a section to our project page for tasks, but that functionality doesn't yet exist. It sounds like we have our next step. View the source code for this episode on GitHub.

13
قسمت 13

Task UI Updates

The next step is to update your project page UI to allow for displaying and adding new tasks.

14
قسمت 14

Task UI Updates: Part 2

In this episode, we'll wrap every task within a form so that we may easily update its description or completion status with the click of a button. View the source code for this episode on GitHub.

15
قسمت 15

Touch It

I'd like to sort all projects in our dashboard according to those that have been most recently updated. This means, when you add or modify a task within a project, we need to touch the parent project's updated_at timestamp in the process. Let's learn...

16
قسمت 16

Notes and Policies

Next up, we need to make the "General Notes" section of the project page dynamic. As always, we'll use tests to drive this new update. When finished, we'll also switch over to using dedicated authorization policy classes. View the source code for...

17
قسمت 17

Improve Test Arrangements With Factory Classes

Let's take a moment to improve the structure of our tests. Have you noticed that, time and time again, we follow a similar pattern when arranging the world for a test? Instead, let's refactor this code into a fluent factory class to save time. To do...

18
قسمت 18

Reduce Form Duplication

In this lesson, we'll add a form to update an existing project. But in the process, we'll review how to reduce duplication in the create and edit views by extracting a reusable partial. View the source code for this episode on GitHub.

19
قسمت 19

Sometimes Validation With Form Requests

We'll begin this episode by addressing a small regression that was introduced in the previous episode: we can no longer update the general notes without triggering a validation error. While of course we'll review the easy solution to this issue, we'l...

20
قسمت 20

Project Activity Feeds

Let's move on to our next feature: every project generates an activity feed. View the source code for this episode on GitHub.

21
قسمت 21

Project Activity Feeds: Part 2

Let's continue working on the project activity feature. We should additionally record activity when a task is created or completed. Let's take care of that in this episode. View the source code for this episode on GitHub.

22
قسمت 22

Project Activity Feeds: Part 3

Before moving on to the larger activity feed refactor, let's first make a few small tweaks to clean things up. View the completed source code for this episode on GitHub.

23
قسمت 23

Project Activity Feeds: Cleanup

We have just a few loose ends to wrap up, before finally viewing the project's activity feed in the browser. View the source code for this episode on GitHub.

24
قسمت 24

Rendering Activity With Polymorphism

It's time to render a project's activity feed on the page. This will give us an opportunity to review how to use polymorphism to load the appropriate view, based on the description type of the activity. View the source code for this episode on GitHu...

25
قسمت 25

The Subject of the Activity

Now that we're successfully displaying a project's activity feed on the page, I'd like to provide more information for each update. For example, rather than the message, "You completed a task", it should probably include the name of the task: 'You c...

26
قسمت 26

Recording Model Changes

Our next job is to track which attributes have changed when a model is updated. This will allow us to record, for example, that the user changed the title of the project from "Test Project" to "Real Project". View the source code for this episode...

27
قسمت 27

Get Into The Refactor Flow

In this episode, we'll refactor all "activity" functionality to a reusable trait. As you'll see, we'll quickly fall into a rapid refactor flow: make a small tweak, run the tests, see green, make another small tweak, rinse and repeat.

28
قسمت 28

Tweaking the Activity Card

Let's work on tweaking the output of the activity card in this lesson. I'd like it to show which fields were updated, and who performed the update. View the source code for this episode on GitHub.

29
قسمت 29

Authorized Users Can Delete Projects

We have an easy one this episode: users who have the proper permissions may delete or archive projects. Let's knock that out now, before moving on to something more exciting in the next episode. View the source code for this episode on GitHub.

30
قسمت 30

Layered Tests and Invitations

As we move on to inviting users to projects, this will give us a nice opportunity to discuss layered tests. In this episode, we'll write the same test name at two different levels: from the outside-in (feature), and at a lower level (unit). View...

31
قسمت 31

Beware False Positives

In this episode, as we work to allow users to see all projects they've been invited to from their dashboard, we'll also discuss false positives. A passing test doesn't always guarantee that your code works as expected. View the source code for th...

32
قسمت 32

Gravatars and Helper Functions

Our project page doesn't yet display all members who have access to it. Let's use Gravatar to generate these thumbnails. In doing so, this will give us the opportunity to discuss how to create and load a helper functions file. View the source code...

33
قسمت 33

Inviting Users as a Feature Test

In this episode, we'll write a few new feature tests to confirm the conditions under which a project owner may invite a user to a project. View the source code for this episode on GitHub.

34
قسمت 34

Validation Errors For Multiple Forms

Once you add multiple forms to a page, you'll quickly find that you can no longer depend on the default validation errors "bag." In this episode, we'll learn how to associate your form request class with a named error bag. View the source code for...

35
قسمت 35

Invited Users May Not Delete Projects

It looks like we have a small hiccup. At the moment, any invited user has permission to delete the project entirely. This action should be restricted to the owner of the project exclusively. View the source code for this episode on GitHub.

36
قسمت 36

Easy Tailwind Themes Using CSS Variables

We have a relatively nice light theme at the moment. But what if we wanted to offer users the ability to toggle to a darker UI theme? How exactly might we accomplish that, considering that Tailwind classes like text-grey and text-blue are scattered t...

37
قسمت 37

Completed Themes Review

Behind the scenes, I've finished up our two themes. Before moving on to building the theme switcher, very quickly, let's review the results as well as the organizational structure I opted for. View the source code for this episode on GitHub.

38
قسمت 38

Build a Theme Switcher

Now that we have multiple UI themes available to us, the next step is to construct a theme switcher that we'll position in the navigation bar of our site. Because there's behavior associated with each theme button, we'll use Vue to build this little...

39
قسمت 39

The New Project Modal

Because we're approaching the end of this series, let's dedicate a few episodes to reviewing some JavaScript-specific enhancements. Specifically, we'll transition the "New Project" form into a dynamic modal Vue component. To begin, we'll pull in t...

40
قسمت 40

The New Project Modal: Behavior

Now that the basic styling for the "New Project" modal is complete, we can move on to its behavior. Luckily, because we have Vue backing us up each step of the way, this should be a cinch to complete.

41
قسمت 41

The New Project Modal: Tasks

There's one final step to complete: our controller doesn't yet allow tasks to be created alongside the project. Let's fix that now. View the source code for this episode on GitHub.

42
قسمت 42

Object-Oriented JavaScript

If we take another look at our NewProjectModal file, you'll notice that most of the JavaScript deals with the submission and handling of the form. It sure would be a shame to repeat this same generic code for every form in our application. With that...

43
قسمت 43

Make a Dropdown Vue Component

Let's wrap things up by creating a reusable dropdown Vue component from scratch. View the source code for this episode on GitHub.

44
قسمت 44

Wrap it Up

A series like this could go on for hundreds of hours, but, at some point, we have to wrap things up. That time is now. Let's do one final review of what we accomplished before saying our goodbyes! View the source code for this series on GitHub.