jeudi 30 juin 2016

Laravel 5.2 : Getting form fields in controller method

I have the following form :

{!! Form::open(['action' => 'PublicController@showProfile','method' => 'post', 'class' => 'form-horizontal']) !!}
{!! Form::token(); !!}
    <input type="text" class="form-control" name="from">
    <span class="input-group-addon"> to </span>
    <input type="text" class="form-control" name="to"> 
    <button type="submit" class="btn blue">Query</button>
{!! Form::close() !!}

In my controller I am getting the form fields like this :

public function showProfile(Request $request)
{
    $to = $request->get("to");
    $from = $request->get("from");
    $giftReceived = App\GiftSent::whereBetween('created_at', [$from, $to])->get();
    dd($from);
    return view('user.profile',compact('giftReceived'));
}

In the above code dd($from) comes null

Am i missing something ?



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

Aucun commentaire:

Enregistrer un commentaire