Same Eloquent Where Condition? Refactor into Local Scopes

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ม.ค. 2025

ความคิดเห็น • 44

  • @Lexgur0088
    @Lexgur0088 3 หลายเดือนก่อน +2

    Thank you for creating all of this, Povilai. TIkrai ačiū :)

  • @maksat607
    @maksat607 2 ปีที่แล้ว

    My number one laravel teacher! Thanks you!

  • @shahzadawahed2579
    @shahzadawahed2579 2 ปีที่แล้ว +1

    Brilliant 👏 👏

  • @peymankhalili8775
    @peymankhalili8775 3 ปีที่แล้ว +1

    very useful, thank you

  • @shafqatalinawaz6218
    @shafqatalinawaz6218 3 ปีที่แล้ว

    Brilliant tip. Thank you so much for sharing.

  • @toitespasmoi
    @toitespasmoi 4 ปีที่แล้ว

    My daily dose of knowledge.

  • @bdiarsa
    @bdiarsa 4 ปีที่แล้ว

    awesome and super explanation

  • @thethmuueinsoe
    @thethmuueinsoe 4 ปีที่แล้ว

    Thank you! Immediately applied in my project.

  • @imranlashari6578
    @imranlashari6578 4 ปีที่แล้ว +1

    I think I am going to your fan soon ; )

  • @kenjohnsiosan9707
    @kenjohnsiosan9707 4 ปีที่แล้ว

    thank you sir😊

  • @Rhidayah
    @Rhidayah 4 ปีที่แล้ว

    That's reduce the query? On laravel debugbar?

  • @msmitsumitsuko
    @msmitsumitsuko 4 ปีที่แล้ว

    Awesome tips thank you

  • @invigale
    @invigale 4 ปีที่แล้ว

    do you plan to discuss repositort method as well?

    • @PovilasKorop
      @PovilasKorop 4 ปีที่แล้ว

      You mean repository pattern? I'm not a big fan of it. I explained it in this free lesson of my course "How to structure Laravel project": laraveldaily.teachable.com/courses/how-to-structure-laravel-project/lectures/8760335

    • @invigale
      @invigale 4 ปีที่แล้ว

      @@PovilasKorop oh pattern sorry. thanks!

    • @invigale
      @invigale 4 ปีที่แล้ว

      ​@@PovilasKorop I appreciate your take on repository patterns. I haven't used it so far in my projects and here I am thinking that it's the "standard" for many companies. thanks!

  • @KyleMerl
    @KyleMerl 4 ปีที่แล้ว

    I freakin love Laravel

  • @NaveedAhmed-xp3nu
    @NaveedAhmed-xp3nu 2 ปีที่แล้ว

    Hi Povilas!
    I think you should update the Eloquent course to the latest version. Is it viable?

    • @LaravelDaily
      @LaravelDaily  2 ปีที่แล้ว

      Yes I'm planning to update it in the Autumn, currently updating the testing course, it takes time.

  • @toomass2668
    @toomass2668 4 ปีที่แล้ว

    Hei, very helpful and good tip. I have a question about collecting views count. What are the good options for getting page/post views for laravel app and vuejs (only) app? Is this something that would be worth doing video on or mby you can comment on that?

    • @PovilasKorop
      @PovilasKorop 4 ปีที่แล้ว +1

      Well, not sure what is problematic here, just in show() method of a controller you do $post->increment('views_count') or something like that.
      And if you have Vue app with API, then you should probably have a separate API endpoint to increase views count.

  • @msdeav
    @msdeav 2 ปีที่แล้ว

    thank you...

  • @edigogidze8349
    @edigogidze8349 4 ปีที่แล้ว

    how what is difference if you write public function postedWithinDays() without scope inside model?

    • @PovilasKorop
      @PovilasKorop 4 ปีที่แล้ว

      It won't work, you can try.

    • @edigogidze8349
      @edigogidze8349 4 ปีที่แล้ว

      does scope work like static function?

    • @PovilasKorop
      @PovilasKorop 4 ปีที่แล้ว

      @@edigogidze8349 no, scope is a scope, it has separate programmed functionality within Laravel framework.

    • @edigogidze8349
      @edigogidze8349 4 ปีที่แล้ว

      thank y for your answear ❤

  • @gram_o_phone
    @gram_o_phone 4 ปีที่แล้ว

    Hey there! Your videos are realyy helpful. Is there any chancee to have your courses in some kind of package? I found 3 of them what really fits my current job of refactoring, so a bundle would be nice. Keep up the good work!

    • @PovilasKorop
      @PovilasKorop 4 ปีที่แล้ว +1

      Hi Gergely, I don't have a special package, but I can offer you a deal: if you buy any 2 of my courses, email me povilas@laraveldaily.com and I will assign you another one for free.

    • @gram_o_phone
      @gram_o_phone 4 ปีที่แล้ว

      @@PovilasKorop Thanks, great! The course "How to Structure..." seems really helpful, and a question pops out already from the preview. I have to deal with an acient project (5.1, all logic in controllers, ~30 models, sad story), after refactoring new funcionality has to be added. However, accessors/mutators introduced, but no model observers in this Laravel version what I miss already.
      What is you opinion, to what version would be the lightest 'pain in the ...' to update? 5.3/5.8 or huge refactoring and switch to 8?

    • @PovilasKorop
      @PovilasKorop 4 ปีที่แล้ว +1

      @@gram_o_phone From what I remember, the biggest structural change and biggest pain to upgrade was from 5.2 to 5.3, later not much has changed globally in the structure of Laravel project, only new functions added and relatively small changes. So depends on your budget/time, I would advise to upgrade to 5.3, but even then it's a question whether it's worth it, just for using observers. You can achieve similar things with events and listeners.

    • @gram_o_phone
      @gram_o_phone 4 ปีที่แล้ว

      @@PovilasKorop 👍 for the advice, just enrolled to the course. Based on your videos, your explaining and coding style is really fits to mine. Thanks!

  • @joshuajohn7698
    @joshuajohn7698 4 ปีที่แล้ว

    Very useful,also I would like to ask, I have a database with this tables. Years, products,sales,
    Years has many products and sales has many to many relationship with products
    I want to get data depends on year when I change year ,all products and sales should in that selected
    Thank you

    • @PovilasKorop
      @PovilasKorop 4 ปีที่แล้ว

      I can't really write the query for you without running that query locally and trying it out with real data. So if you have this project with data available on Github, please invite me as a collaborator (username PovilasKorop) and I will try to write that query for you.

  • @amgadalwattar2863
    @amgadalwattar2863 2 ปีที่แล้ว

    thanks

  • @nabeelyousafpasha
    @nabeelyousafpasha 4 ปีที่แล้ว

    Thanks. Please Elaborate chaining of svopes also

    • @PovilasKorop
      @PovilasKorop 4 ปีที่แล้ว

      Not sure what can I elaborate about, it's just one extra sentence, that you can do User::active()->registeredWithinDays(14)->get();
      So won't shoot a separate video about it.

    • @nabeelyousafpasha
      @nabeelyousafpasha 4 ปีที่แล้ว

      @@PovilasKorop i was just interested to let others know that chaining does exist in scopes. BTW thanks alot

  • @jacklee8446
    @jacklee8446 4 ปีที่แล้ว

    awesome

  • @sancakyuksel
    @sancakyuksel 4 ปีที่แล้ว

    Thanks :)

  • @nishantgupta1854
    @nishantgupta1854 4 ปีที่แล้ว

    dream to meet and thank you

  • @РустР
    @РустР 4 ปีที่แล้ว

    Eloquent is full shit. Don't use him never in big and mid projects. It is possible to use only for one-page landings or very simple projects.