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

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

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

  • @fanievdm1
    @fanievdm1 7 หลายเดือนก่อน +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 7 หลายเดือนก่อน

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

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

    Thanks for the detailed explanation..

  • @maxzak5310
    @maxzak5310 7 หลายเดือนก่อน +3

    i like whereAll , whereAny ... very handy

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

    Thanks for these useful tips

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

    Thank you very much!

  • @fredchess
    @fredchess 7 หลายเดือนก่อน +1

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

  • @SebastianMares
    @SebastianMares 7 หลายเดือนก่อน +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.

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

    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  7 หลายเดือนก่อน

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

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

    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  7 หลายเดือนก่อน

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

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

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