lundi 30 avril 2018

Type error: Too few arguments to function createRoute(), 0 passed and exactly 3 expected in RoutesController

I'm working on Laravel 5.6,

I'm creating a function that receives three parameters ($name_route, $description_route, $photo_route) that I would like to be inserted on table Route, but I'm having the following error that can't explain:

"Type error: Too few arguments to function App\Http\Controllers\RoutesController::createRoute(), 0 passed and exactly 3 expected in RoutesController.php (64)"

What am I doing wrong if I'm passing those three variables? I'm testing using Swagger. Can you help to guess what's going wrong? Never happened to me something like this.

Thanks in advance!!

Here's how I'm setting in my routes file (routes.php):

 /** ***********************************************************
 *  Logged user can create a route
 * ************************************************************
 * @SWG\Post(
 *      tags={"Routes"},
 *      path="/api/v1/routes/route/create",
 *      summary="Logged user can create a route",
 *      @SWG\Parameter(ref="#/parameters/Accept"),
 *      @SWG\Parameter(ref="#/parameters/apikey"),
 *      @SWG\Parameter(ref="#/parameters/Language"),
 *      @SWG\Parameter(ref="#/parameters/Authorization"),
 *      @SWG\Parameter(name="name", in="path", type="string"),
 *      @SWG\Parameter(name="description", in="path", type="string"),
 *      @SWG\Parameter(name="photo", in="path", type="string"),
 *      @SWG\Response(response=HTTP_CODE_200_OK, description="Routes", 
        @SWG\Schema(ref="#/definitions/RouteDetail")),
 * )
 */
Route::post('/route/create', 'RoutesController@createRoute')->middleware('auth:api');

And my controller:

 /**
 * @param $name_route
 * @param $description_route
 * @param $photo_route
 */
public function createRoute($name_route, $description_route, $photo_route)
{
    $route = new Route();

    $route->user_id = $this->input($this->user()->id);
    $route->name = $this->input($name_route);
    $route->description = $this->input($description_route);
    $route->photo = $this->input($photo_route);

    $route->save();
}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2r7F6n0
via IFTTT

Aucun commentaire:

Enregistrer un commentaire