Notification bell This series has been archived.
A series is marked as archived when the content is no longer up-to-date or relevant to most viewers.
Back Button Techniques
Commands and Domain Events

Commands and Domain Events

As you advance in your career, you'll quickly fall into the "sequential tasks" trap. "I need to do these ten things when a user signs up.... but I have no idea where to place this logic." Many times, we give up and simply throw it in the controller. But is that the best place? Might there be a better way (when appropriate) to structure our applications? Sure! Let me show you.

Advanced
7 episodes
1h 15m
7
Latest Episode in This Series

Added 4 years ago

Extracting a Composer Package

Now that our review of commands and domain events is complete, let's extract a Composer package, so...

Watch
Commands and Domain Events

Commands and Domain Events

As you advance in your career, you'll quickly fall into the "sequential tasks" trap. "I need to do these ten things when a user signs up.... but I have no idea where to place this logic." Many times, we give up and simply throw it in the controller. But is that the best place? Might there be a better way (when appropriate) to structure our applications? Sure! Let me show you.

Begin
7
Latest Episode in This Series

Added 4 years ago

Extracting a Composer Package

Now that our review of commands and domain events is complete, let's extract a Composer package, so...
Watch

Your Teacher | Jeffrey Way

https://laracasts.s3.amazonaws.com/avatars/jeffrey-avatar.jpg's avatar
Hi, I'm Jeffrey. I'm the creator of Laracasts and spend most of my days building the site and thinking of new ways to teach confusing concepts. I live in Orlando, Florida with my wife and two kids.
    1. Free Episode Run Time 7:11

      In the opening episode, we'll review the "sequential tasks" dilemma, while introducing the concept of command objects.

    2. Run Time 8:34

      Now that we have our first command object, we next need to calculate the appropriate handler class, which will delegate, as needed. Let's tackle that in this episode. Go sports!

    3. Run Time 15:32

      So we've successfully translated a command into its associated handler class. In this lesson, we'll delegate, as needed, to post the job listing - while raising domain events in the process.

    4. So, we've learned how to dispatch our custom events, but how do we go about listening for them? Well, in this lesson, I'll show you a really nice and clean way to go about it! Let's do this.

    5. Run Time 7:18

      Now that our base is essentially complete, let's go through the process of, using our job site example, marking jobs as filled, or archived.

    6. In this lesson, we'll extend the functionality of the command bus by adding a validation decorator, while also reviewing an implementation that uses simple inheritance.

    7. Now that our review of commands and domain events is complete, let's extract a Composer package, so that we can reuse this logic across all new projects! See the completed package on GitHub!