dimanche 29 mai 2016

building search function in laravel 5

I have this view to search for name or telephone no.

<form method="POST" action="">
 {!! csrf_field() !!}
<input type="text" name="search" placeholder="Name or Telephone no.">
<input type="submit" class="btn-btn-default" value="search">

The route redirecting to this controller:

 public function search(Request $request)
  {
        $name=$request->get('search');
        $search=telephone::where('name','like',$name)
                            ->paginate(5);

        return view('telephone.searchview',['search'=>$search]);
}

which then supposed to show this view:

<thead style='background-color:silver'><tr><td>S.N.</td><td>Name</td><td>Telephone No.</td><td>Mobile No.</td><td>Options</td></tr></thead>
@foreach ($search as $li)
<tr><td></td><td></td><td></td><td></td>
<td>here</td></tr></table>
@endforeach
{!! $search->render() !!}

i got the error: TokenMismatch



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire