jeudi 30 juin 2016

Laravel 5.2 : Getting form fields in controller method

I have the following form :

{!! Form::open(['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"> 
{!! 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 ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire