We Love PHP Attributes

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

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

  • @einarjhansen
    @einarjhansen Месяц назад

    Great video Cristoph! Super useful for catching up and seeing what’s moving in the Laravel world. I got a feeling we will see a lot more attributes in the months to come.

    • @LaravelPHP
      @LaravelPHP  Месяц назад

      thanks a lot, appreciate it 🙏 I hope so too =) (Christoph)

  • @incoming-th
    @incoming-th Месяц назад +21

    I have mixed opinions with those attributes, because it can be useful and shorthand, I don't think they are clean because I have a lot of docblock and mixing with those attributes it's making the code like a mess to read. All those videos are presenting the attributes without a docblock.

    • @Silas_229
      @Silas_229 Месяц назад +4

      They remind me of jakarta and this java enterprise stuff is just awful

    • @hydrokat143
      @hydrokat143 Месяц назад

      I can see that the attributes work as "doc blocks" alr. Personally i would still prefer doc blocks for my old and current projects.
      Maybe ill try using these over doc blocks in the future.

    • @CosmicNox-cn1
      @CosmicNox-cn1 Месяц назад +1

      I still don't know if it's a good or a bad idea either.
      In the first case presented, it's kinda cool because it doesn't shadow the logic. Nothing too magic.
      But it can be quite messy if there are too much attributes.
      I still prefer a config file with all observers/scope defined. It's more obvious and all at the same location.
      Less magic, less headaches when maintenance is needed.

  • @Frank-ou2nr
    @Frank-ou2nr Месяц назад +18

    Whats up with the random music starting at 7:51 and making the explanation very hard to hear?

    • @kouceylahadji
      @kouceylahadji Месяц назад

      I agree

    • @isaachatilima
      @isaachatilima Месяц назад

      Right.. it served no purpose at all.

    • @sllkevin8885
      @sllkevin8885 Месяц назад

      I didn’t notice, it wasn’t hard to hear for me listening on mobile but could see how it would be distracting or hard to hear on some devices 👍

    • @LaravelPHP
      @LaravelPHP  Месяц назад

      That was a mistake, sorry for that. RUclips does not let you change that after upload. (Christoph)

  • @TheKluVerKamp
    @TheKluVerKamp Месяц назад +1

    This started to look like Spring :D the lovely parts which is amazing! keep up the amazing work

    • @LaravelPHP
      @LaravelPHP  Месяц назад

      Thank you so much! 🙏 (Christoph)

  • @rogue.ganker
    @rogue.ganker Месяц назад +14

    Clean and nice until someone adds like 10 to it and abuses it

    • @ericadedayo1593
      @ericadedayo1593 Месяц назад

      I thought it would be a great idea to use the Attribute and the booted() for more if it exist.

  • @SebastianMares
    @SebastianMares Месяц назад +3

    I have mixed opinions. Adding alternative ways to do some things might seem nice and flexible, but imagine being a new developer in a large project that isn't well documented and you have to start to check for attributes, observables, magic functions, etc.

    • @LaravelPHP
      @LaravelPHP  Месяц назад

      Thanks.
      I agree that can become difficult but this is always the case with big projects and when you provide different options and Laravel is in many ways quite flexible which is also what many like. Let's see what the future holds with Attributes. (Christoph)

  • @Voltra_
    @Voltra_ Месяц назад

    They're really handy! I also really like spatie's route attribute package that makes routing a breeze with controllers

    • @LaravelPHP
      @LaravelPHP  Месяц назад

      thanks a lot. Yeah that is cool too, but web.php is 😍 (Christoph)

  • @smokeyoak
    @smokeyoak Месяц назад

    There are a lot of ideas in here that are new to me, this was helpful. I'll definitely be using attributes in my requests now because I've made some messes in there in the past

    • @LaravelPHP
      @LaravelPHP  Месяц назад

      Awesome, all the best! (Christoph)

  • @Htbaa
    @Htbaa Месяц назад +4

    So :: couldn’t be used for namespaces as it was already used for something else but a line starting with a hashtag, which is used for a comment, is perfectly fine? For me this is just one big unreadable mess.

  • @SXsoft99
    @SXsoft99 Месяц назад +1

    I never liked comments as code in simfony and was the main reason i stuck with laravel, but I admit they have their moments.

    • @LaravelPHP
      @LaravelPHP  Месяц назад

      Yeah a lot of different opinions about them, thats why we have multiple solutions. (Christoph)

  • @Ali-hh9oi
    @Ali-hh9oi Месяц назад +1

    Try lift package for model attributes and also there is a spatie routing with attribute package.

  • @adrianspacely
    @adrianspacely Месяц назад

    Sounds like there should be a `#[ModelScopeBy(CustomUserEloquentBuilder::class)]`

  • @dominikbetlej7114
    @dominikbetlej7114 Месяц назад

    Thx!

  • @favour5442
    @favour5442 Месяц назад

    Its just easier to use the where method 2:30

  • @daresamiuel
    @daresamiuel Месяц назад

    🎉🎉🎉

  • @parijke
    @parijke Месяц назад +1

    I really could not listen to you anymore after 8 minutes when the music started.... Why?

    • @LaravelPHP
      @LaravelPHP  Месяц назад +1

      That was a mistake. Sorry about that. RUclips does not let you change such mistakes. (Christoph)

  • @gilney.mathias
    @gilney.mathias Месяц назад +9

    i for one really dont like those ¯\_(ツ)_/¯

    • @LaravelPHP
      @LaravelPHP  Месяц назад

      Thats ok, thats why we have multiple options. To be honest, I didn't like them at all when they came out in PHP some time, but it changed for me :-) (Christoph)

  • @pippop9583
    @pippop9583 4 дня назад

    This is the dotnet feature every long time ago to make your code look ugly

  • @pippop9583
    @pippop9583 4 дня назад

    I don't like it anyway

  • @RexTangle4
    @RexTangle4 Месяц назад

    honestly hate these (sorry). comment syntax should be reserved for comments. if we're going to invent a new way to inject logic it should be 100% clear that's what we're doing

    • @LaravelPHP
      @LaravelPHP  Месяц назад

      Fair enough. That's why we provide multiple options 👍 (Christoph)