Rich domain models with Active Record

Поделиться
HTML-код
  • Опубликовано: 9 фев 2025
  • Coding starts at 03:00
    👨‍💻 Learn Test-Driven Development with Laravel!
    tddwithlaravel...
    Sign up to 30 Days of Laravel 👉🏻 30daysoflarave...
    👨‍💻 Sign up to my newsletter and receive PHP, JS and Laravel news in a weekly-basis:
    subscribe.mate...
    🎉 Party up:
    / mateusjatenee
    / mateusjatenee
    / mateusguimaraes
    Thanks for watching!

Комментарии • 10

  • @dion3109
    @dion3109 20 часов назад

    Please post more frequently! 😊

  • @vladhitrov
    @vladhitrov День назад

    What a timing, I was just researching about rich domain model with eloquent!

  • @vitaliinevada7888
    @vitaliinevada7888 20 часов назад

    So good demonstration, especially with such practical examples. Great video!

    •  16 часов назад

      Thanks, glad you liked it!

  • @LebaneseNostalgia
    @LebaneseNostalgia 18 часов назад

    I would love to see you create a paid course on building a complete e-commerce platform as a Laravel package that is modular, extendable, and reusable.

  • @Aalii6
    @Aalii6 День назад

    Great topic, thank you!

  • @necrotikS
    @necrotikS 17 часов назад

    At 19:21, you said you'd have a command and wrap it inside a transaction, so you wouldn't need to have DB::transaction() inside the place() method. Why is that? Isn't it a "good" practice to make sure that the place() method is always an "atomic" operation? What if someone called the place() method outside a transaction?

    •  16 часов назад +1

      Yes and no - in non-AR implementations, you typically mutate state and delay persistence to the end of the operation, so you have a small window in which DB operations are going to occur, typically within a repository - in that case, handling DB transactions is a bit straightforward.
      With AR, persistence might happen in several places, so it could be interesting to ensure the methods themselves are atomic.
      OTOH, you can have several operations happen within a command, and more often than not you want the entire command to be a single unit of work. An option is to leverage nested transactions (through Eloquent), so you can have the command be atomic, and also the method (if it persists anything).

    • @necrotikS
      @necrotikS 16 часов назад

      Yeah, makes sense. Thanks for the answer. In my opinion, you're the best regarding Laravel and advanced topics. I really like the way you code and the examples you use, you know how to go deep. Congratulations.

  • @KFlosjes
    @KFlosjes День назад

    Great video. I wish you would create a router from scratch (laravel inspired) named routes, groups, etc etc maybe even middleware handling. wouldnt mind paying for such a course.