How to create a fluent query interface?

后端 未结 3 745
轻奢々
轻奢々 2020-12-03 03:48

I know how to chain class methods (with the \"return $this\" and all), but what i am trying to do is to chain them in a smart way, have a look at this:

$albu         


        
3条回答
  •  爱一瞬间的悲伤
    2020-12-03 04:38

    This takes a really elegant solution.

    Instead of reinventing the wheel, look into an existing framework(s).

    I suggest Laravel using the Eloquent ORM. You'll be able to do this and MUCH more.

提交回复
热议问题