I am working on laravel 5.3 search function that is supposed to search for service_provided in table called services
below is my form
@extends('layouts.app')
@section('title', '| View Search Results')
@section('content')
<div class="container">
<div class="flex-center position-ref full-height">
<div class="content">
<div class="title m-b-md">
Service
</div>
{!! Form::open(['route' => 'search.create']) !!}
<div class="container" id="SearchBox">
<div class="col-xs-8 col-xs-offset-2">
<div class="input-group">
{!! Form::text('search',null,array('class' => 'form-control','placeholder' => 'Search term...','aria-describedby' => 'basic-addon2')) !!}
<span class="input-group-addon" id="basic-addon2">
{!! Form::submit('Search',array('class'=> 'btn btn-default')) !!}
</span>
</div>
</div>
</div>
{!! Form::close() !!}
</div>
</div>
</div>
@endsection
My Seach function create is as below
public function create(Request $request)
{
//// Gets the query string from our form submission
$query = $request->input('search');
// Returns an array of articles that have the query string located somewhere within
// our articles titles. Paginates them so we can break up lots of search results.
$services = DB::table('services')->where('city', 'LIKE', '%' . $query . '%')->paginate(10);
// returns a view and passes the view the list of articles and the original query.
return view('search.search', compact('services', 'query'));
}
my route is as follows
Route::get('search.index',array('as'=>'index','uses'=>'SearchController@index'));
Route::get('search.create',array('as'=> 'create','SearchController@create'));
The error message im getting when i submit the form is as below
Whoops, looks like something went wrong. 1/1 MethodNotAllowedHttpException in /home/archie/servicepap/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php line 218:
in RouteCollection.php line 218
at RouteCollection->methodNotAllowed(array('GET', 'HEAD', 'PUT', 'PATCH', 'DELETE')) in RouteCollection.php line 205
at RouteCollection->getRouteForMethods(object(Request), array('GET', 'HEAD', 'PUT', 'PATCH', 'DELETE')) in RouteCollection.php line 158
at RouteCollection->match(object(Request)) in Router.php line 780
at Router->findRoute(object(Request)) in Router.php line 610
at Router->dispatchToRoute(object(Request)) in Router.php line 596
at Router->dispatch(object(Request)) in Kernel.php line 267
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
at Pipeline->then(object(Closure)) in Kernel.php line 149
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
at Kernel->handle(object(Request)) in index.php line 53
at require_once('/home/archie/servicepap/public/index.php') in server.php line 21