如何将函数调用到函数中到 class?

How can I call function into function into class?

我非常想将函数调用到函数中 class,就像 laravel 与 oop php 的工作方式一样 示例:

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

这不可能吗?

您的 class 方法需要 return $this,这将允许您像那样链接调用。

您可以使用 $this->functionName();

调用