BEWARE these Laravel attributes | Real World Laravel

Поділитися
Вставка
  • Опубліковано 2 лис 2024

КОМЕНТАРІ • 29

  • @lnplum
    @lnplum 20 днів тому +2

    Here's a comment for the algorithm gods.

  • @Fosterushka
    @Fosterushka Місяць тому +3

    Man, that so cool to see how people get dive into Laravel community. Welcome , intersting to watch and also learn something new , keep it up. Wanna see video about testing :)

  • @kemal6039
    @kemal6039 19 днів тому

    I'm so glad I discovered this channel because I've been looking for a Laravel related content just like this one for *years*! And I also appreciate you showing the actual code you run on production (even though it's/was a little ugly lol, these are our babies!)
    Also what extension are you using to show syntax errors on the IDE? That seems very useful

    • @samldev
      @samldev  19 днів тому +2

      I’m using PHP Intelephense but the Laravel team is releasing an official VS Code extension sometime this year which I’m pumped for!

  • @vitorgabriel15
    @vitorgabriel15 11 днів тому

    Good content. Thanks for sharing!

  • @TortelliniSRL
    @TortelliniSRL 16 днів тому

    Hey sorry, what's the extension that shows you error messages inline like at 12:09?

    • @samldev
      @samldev  15 днів тому

      Intelephense but Laravel has an official vs code extension coming soon 🔜

    • @TortelliniSRL
      @TortelliniSRL 15 днів тому

      @@samldev thanks, although i've been using intelephense (free) for years and it never changed the way errors are displayed in the IDE, not sure if it's a PRO feature specifically
      in case someone else is interested i just managed to find a plugin from a development pack to achieve the exact same behavior called "Error Lens". It also seems to be language server agnostic so it works outside the php scope too
      btw appreciate the availability :D

  • @dmxd
    @dmxd Місяць тому +3

    You don't have to manually go through your app to make sure your change didn't break anything - there're automated test exactly serve this purpose.

    • @samldev
      @samldev  Місяць тому +2

      I mentioned that in the video 😁

    • @itsTarik
      @itsTarik Місяць тому

      ​@@samldev You can even make a video about it 👀

    • @samldev
      @samldev  Місяць тому

      Ha I was trying to decide how to make a video on Dusk testing. Since it’s new to me it’d be difficult to “do it live”, but I could figure it out then either reimplement it for a video or just walk through what I did. Any thoughts which you would prefer?

    • @itsTarik
      @itsTarik Місяць тому

      @@samldev Walking through the code is fine for me. It depends if you want to make it a tutorial or an overview type of video. Totoriel will be longer and more beginner-friendly. You have more statistics to make this decision either way, I will watch it.

  • @relaxationtube2388
    @relaxationtube2388 Місяць тому +2

    You should use JSON Resource. Only query and pass the data you need in the controller. Also passing the entire user model to inertia isn’t a good idea. I assume you may just be starting out with Laravel, good luck 👍

    • @samldev
      @samldev  Місяць тому

      I use the $hidden attribute on my user model to control what gets sent to the client. But I am fairly new to Laravel yes!

    • @jorni6324
      @jorni6324 Місяць тому

      I can vouch for Json resources, it gives you so much control and using whenLoaded gives you so much clarity on when you're having an N+1 query because the data won't show.
      Ofc just use debugbar, but still Json resource are amazing.
      Also the whenLoaded method is used to just not show the data when you don't have or want to.

    • @relaxationtube2388
      @relaxationtube2388 Місяць тому

      @@samldev that’s not enough, for instance, every user will see every other user’s email. In a UserResource you could use the when method to prevent it

    • @samldev
      @samldev  Місяць тому +2

      @@relaxationtube2388 hm I don’t think so. How would they see every other users email? I am not passing all users to the front end, only the currently authenticated user

  • @olugbengadavid6669
    @olugbengadavid6669 Місяць тому

    hi @samldev what too was used to check the queries?

    • @samldev
      @samldev  Місяць тому

      laravel debug bar by barryvdh github.com/barryvdh/laravel-debugbar

    • @kemal6039
      @kemal6039 19 днів тому

      It's called Laravel debugbar, you can install it by running this command in your project directory :
      composer require barryvdh/laravel-debugbar --dev

  • @azaman3772
    @azaman3772 Місяць тому

    Nice optimization tip

  • @vijaychauhan2450
    @vijaychauhan2450 Місяць тому

    It's very useful tips 👍

  • @basic-1337
    @basic-1337 Місяць тому +1

    well, taylor fix it with new method called chaperone(), just define it on the has* method
    but it will released on Q4 2024
    1:53 also stop show off those colourfull eyes xD

  • @FellowDeveloper
    @FellowDeveloper Місяць тому

    generally $with is not a good idea. so is appends.
    I prefer loading data when and only when it's required..

  • @PavolJeleník
    @PavolJeleník Місяць тому

    jesus lord what an irritating intro.... click, click, click

    • @samldev
      @samldev  Місяць тому

      Haha yeah I didn’t know how else to demonstrate the delay between clicking and loading 🤷‍♂️

    • @lnplum
      @lnplum 20 днів тому

      It's fine. I enjoyed the format. Don't need to know what all the code looks like. I guess it's more intermediate to advanced than beginner but there's plenty of beginner content out there for people who want more hand holding.