public function User(Request $request){}
public function User(Request $request){}
http://php.net/manual/zh/language.oop5.typehinting.php
PHP 5 can use type constraints.
The parameters of the function can be specified to be objects (specify the class name in the function prototype), interfaces, arrays (from PHP 5.1) or callable (from PHP 5.4).
Official example
<code> /** * 测试函数 * 第一个参数必须为 OtherClass 类的一个对象 */ public function test(OtherClass $otherclass) { echo $otherclass->var; }</code>
Request is a class, and $request is an object generated by it! Of course, it can also be an interface or something like that!