Eloquent where(): 6 "Tricks" You May Not Know

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 พ.ย. 2024

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

  • @fanievdm1
    @fanievdm1 5 หลายเดือนก่อน +1

    Thanks for the tips. One tends to do the 'old stuff' instead of enhancing your code. The tips are very helpful.

  • @chlouis-girardot
    @chlouis-girardot 5 หลายเดือนก่อน

    Such valuable information/reminders, thank you (again) Sir! 🙏

  • @LoganathanNatarajanlogudotcom
    @LoganathanNatarajanlogudotcom 5 หลายเดือนก่อน

    Thanks for the detailed explanation..

  • @asfiaaiman3699
    @asfiaaiman3699 5 หลายเดือนก่อน

    Thanks for these useful tips

  • @maxzak5310
    @maxzak5310 5 หลายเดือนก่อน +2

    i like whereAll , whereAny ... very handy

  • @SebastianMares
    @SebastianMares 5 หลายเดือนก่อน +1

    One thing I cannot stress enough is orWhere with scopes or relations. Always use a callback for your orWhere statements. $author->posts()->where('foo', 'bar') will give you all posts belonging to the author where foo is 'bar', but $author->posts()->where('foo', 'bar')->orWhere('abc', 'xyz') will no longer have abc = 'xyz' scoped to the $author. Same goes with scopes. $builder->where('created_at', '', 500); will probalby also not yield what you were expecting.

  • @muhammadumarsotvoldiev8768
    @muhammadumarsotvoldiev8768 5 หลายเดือนก่อน

    Thank you very much!

  • @fredchess
    @fredchess 5 หลายเดือนก่อน

    Please what do you use to make quick printing like this?

  • @NitishKumarPatra
    @NitishKumarPatra 5 หลายเดือนก่อน

    I didn't get the info about created_at won't work if there is a index on it, and would work then index is created with date ?? Could you please make a video on it ? Such conditions are commonly used throughout projects, but i guess many are unaware, including me.

    • @LaravelDaily
      @LaravelDaily  5 หลายเดือนก่อน

      I mean you need to create an index on DATE(created_at) and not created_at, not sure it needs a video

  • @BBB888BBB
    @BBB888BBB 5 หลายเดือนก่อน

    would you please explain why the word(data) is put in page.jsx when using inertia ? example : to loop : projects.data.map(project).... i saw this and i don't know why . ( in working laravel with react inertia) i saw that .

    • @LaravelDaily
      @LaravelDaily  5 หลายเดือนก่อน

      From what I remember, it's how Laravel API resources return the data by default. Read the docs of Eloquent API resources.

  • @SXsoft99
    @SXsoft99 5 หลายเดือนก่อน +2

    what i always tell people "read the docs". I get it if you come from other frameworks it's a pain