自定义类:
namespace App\Http\services\register;
use App\Http\model\register\sign;
use App\Http\services\common\Inter;
use App\Http\services\common\Demo;
use Illuminate\Http\Request;
use Illuminate\Contracts\Validation\Validator;
class Resign extends Demo implements Inter{
public $request;
public function __construct(Request $request)
{
$this->request = $request;
}
public function logic(){
dd($this->request->all());
}
}
控制器:
namespace App\Http\Controllers\Admin;
use App\Http\services\common\Demo;
use Illuminate\Http\Request;
use App\Http\services\register\Resign;
use Illuminate\Contracts\Validation\Validator;
class SignController extends Demo
{
public function Register(){
$reg =new Resign((new Request()));
$reg->logic();
}
}
请问 :我依赖注入Request 类 ,我在自定义类里打印 总是空数组,我前台表单 已经提交数据了。