Laravel Movie App - Refactoring to View Models - Part 6

Поделиться
HTML-код
  • Опубликовано: 3 июл 2024
  • We take a look at refactoring our code by simplifying our views and removing any logic from them. We make use of Spatie's View Model Package to extract any logic from the view into a View Model class.
    Spatie Laravel View Models: github.com/spatie/laravel-vie...
    GitHub Repo: github.com/drehimself/laravel...
    TMDb API: www.themoviedb.org/documentat...
    LINKS
    My courses: codewithdre.com
    Sign up for my newsletter: andremadarang.com/newsletter
    My website: andremadarang.com
    Twitter: / drehimself
    GitHub: github.com/drehimself
    CodePen: codepen.io/drehimself
  • НаукаНаука

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

  • @heyimamaker
    @heyimamaker 4 года назад +1

    The ViewModelsare so powerful, I was able to refactor a lot further ( I also created Genre and Actor pages ) by using Traits.

  • @imPriyankCoder
    @imPriyankCoder 4 года назад

    Wow awesome. Cant wait to work an awesome good project like this another one

  • @filipeassuncao6663
    @filipeassuncao6663 Год назад

    Thanks for the content, in MovieViewModel the method flatten does not require, pluck('name') just enough.

  • @mauriciobuffa1136
    @mauriciobuffa1136 2 года назад

    Ty!

  • @vilhemleshi7222
    @vilhemleshi7222 Год назад

    Amazing

  • @heyimamaker
    @heyimamaker 4 года назад

    I would love to see PHP Storm add click through to Components!

  • @krzysztofk9563
    @krzysztofk9563 4 года назад

    Awesome! Please shop / CMS / CRM in Laravel 7!

  • @shekhsaifuddin1353
    @shekhsaifuddin1353 4 года назад

    What will be the short syntax, I tried but it shows me that you have to update 7.4 in composer.json, can we use arrow function in map() .?

  • @hectorperedo3399
    @hectorperedo3399 3 года назад +1

    Good tutorial, but I really suffered with the complexity when within the MoviesViewModel in formatMovies function do a nested loop to get the genres, multiple mapWithKeys are made to get the genres for each movie genre.

  • @heyimamaker
    @heyimamaker 4 года назад

    I created a Genres route and updated my movie component to include the link. The tests now no longer pass. But because it is based on what it sees, and the Genres are part of the ViewModel I am not sure how to debug and correct the issues.
    The output shows the links with the correct Genres, any tips, or tricks?

  • @minhannguyen3869
    @minhannguyen3869 4 года назад

    Hello, can you make a list of electron js?

  • @IraqNews2022
    @IraqNews2022 4 года назад

    hi please i want the name of the music at end of video?

    • @drehimself
      @drehimself  4 года назад +1

      Just some royalty-free music I bought on audio jungle. Forgot the name.

    • @IraqNews2022
      @IraqNews2022 4 года назад

      @@drehimself thank you

  • @karlebh
    @karlebh 4 года назад

    I read your reply to @felipe but I don't it exactly answers this question: can't view composer do what you did with Laravel view model?

  • @kevinking1566
    @kevinking1566 2 года назад

    Don't know if I'm missing something here. I am still a noob. But how does the formatMovies method in your MoviesViewModel know that the $movies parameter is the array of movies? Where did that come from? Can someone explain this to me?

  • @saphi20
    @saphi20 4 года назад

    didnt they just release that in laravel 7 as view components?

  • @user-jk9df1ei2m
    @user-jk9df1ei2m 3 года назад

    good

  • @felipeballoni76
    @felipeballoni76 4 года назад

    Hi, I was trying understand if Laravel view composers or a livewire component can do almost the same, didn't we? Or not? (it's my newbie doubt). Thanks for this amazing series.

    • @drehimself
      @drehimself  4 года назад

      I look at view composers as a way to share data across multiple views.

  • @fahadakhtar65
    @fahadakhtar65 4 года назад

    please make a spatie package tutorial

  • @onessimuslyngdoh289
    @onessimuslyngdoh289 4 года назад

    What package are you using for class import?

    • @drehimself
      @drehimself  4 года назад

      PHP Companion: github.com/erichard/SublimePHPCompanion

  • @nokahvandenhoven
    @nokahvandenhoven 4 года назад

    i'm getting this error Class 'App\Http\Controllers\MoviesViewModel' not found in the moviescontroller ?

  • @ahmedsunil3235
    @ahmedsunil3235 4 года назад

    how many tutorials totally?

  • @hanafiadhi7156
    @hanafiadhi7156 4 года назад

    How many parts do you need to complete it?

    • @drehimself
      @drehimself  4 года назад

      I have a few more already done. Not sure if I'm going to keep it going after that. We'll see.

  • @Stoney_Eagle
    @Stoney_Eagle 4 года назад

    All it needs now is a video encoder and player.... 😅