samedi 4 mai 2019

How to create yourself "tailed-function: like object array but function" as Laravel does in its eloquent?

Laravel eloquent has great job for managing queries. We can easily put simple statistics on it. For example, I have table called "Students" then I tried to count boys only as follow:

$total = Students::where(['sex'=>'boy'])->count();

I use service provider for creating my own function that I am able to call them using the format SomeClass::MyFunction(). My question is how to create function like-object array so that I can call them as follow:

$var = SomeClass::MyFunction()->newFunction();

Thank you for your help!



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2JoLH6H
via IFTTT

Aucun commentaire:

Enregistrer un commentaire