Search code examples
phpfluent-interface

How can I call function into function into class?


I'm exactly want to call function into function into class, like how exactly laravel works with oop php example:

App\Flight::where('active', 1)->orderBy('name', 'desc') ->take(10)->get();

Is that impossible?


Solution

  • Your class methods need to return $this, which will allow you to chain calls like that.