dimanche 1 mai 2016

Convert array to Request object in laravel 5

I have store method in user controller like this

public function store(Request $request)
{
    User::create($request->all()); 

}

and in another controller I want use this method

 public function test(Request $request)
{
  .....
   app('\App\Http\Controllers\UserController')->store($request);
  ...
}

and $request is:

{"name":"test","email":"test@gmail.com"}

and finally show me error this

Argument 1 passed to App\Http\Controllers\UserController::store() must be an instance of Illuminate\Http\Request,

How can I convert array to Request object?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire