samedi 27 février 2016

laravel how to send request o a controlle with parameter

I am working on laravel 5

this is my controller

<?php

namespace App\Http\Controllers;

use App\User;
use App\Http\Controllers\Controller;

class RequestController extends Controller
{

    public function sendRequest($endPoint, $body)
    {

        return view('response', "d");
    }
}

?>

and in my route i handle it like this:

Route::post("/request/send", 'RequestController@sendRequest');

then in my html i do

<form method="post" action="/request/send">
        <textarea id="code" contentEditable="true" name="body"></textarea>
        <input type="text" value="d" name="endPoint" />
        <input type="button" id="formattCode" value="format"/>
        <input type="submit" value="send"/>
    </form>

as you see, i do have the body and the endPoint in my html

however i am getting this error

ErrorException in RequestController.php line 11:
Missing argument 1 for App\Http\Controllers\RequestController::sendRequest()



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1S8mdIy
via IFTTT

Aucun commentaire:

Enregistrer un commentaire