I created a laravel 5 application, and now I am testing how it handles different inputs. So I ran into some kind of weird problem. In the title, I have a search box. It returns results broken down by 10.
Problem
If the user enters a letter, for example "e" in English, everything works fine. However, when the user enters a letter, for example, āeā in Bulgarian - the first page of results is displayed correctly, and when the user types page 2, the search query from āeā in Bulgarian changes to ā% D0ā% B5 ā, and more results are not visible. Here is the actual link to the site.http: //podobri.eu
I guess this has something to do with the encoding, but I don't see what I'm doing wrong.
Here is the actual code
Route
Route::get('/search', [ 'uses' => '\Podobri\Http\Controllers\ SearchController@getResults ', 'as'=>'search.results', ]);
SearchController
public function getResults(Request $request){ $query = $request->input('query'); $comments = Comment::where(function($query){ return $query; })->orderBy('created_at', 'desc')->get(); if(!$query || $query==''){ return view('problems.index')->with('comments', $comments); } $problems = Problem::where(DB::raw("CONCAT(problem_title, ' ', problem_description)"), 'LIKE', "%$query%") ->orWhere('location', 'LIKE', "%$query%") ->orWhere('category', 'LIKE', "%$query%") ->orderBy('created_at', 'desc')->paginate(10); Carbon::setLocale('bg'); return view('search.results') ->with('comments', $comments) ->with('problems', $problems) ->with('title', ' "'."$query".'" | ') ->with('description', ' "'."$query".'" '); }
View
@foreach($problems as $problem) <div> @include('problems.partials.problemblock') </div> @endforeach {!! $problems->appends(Request::except('page'))->render() !!}
Search form
<form action="{{ route('search.results') }}" role="search" class="navbar-form navbar-left head-form-responsive"> <div class="form-group"> <input type="text" required id='searchQuery' title=" " value="{{ Request::input('query') }}" name="query" class="form-control" placeholder=" "/> </div> <button type="submit" id='searchBtn' class="btn btn-default"></button> </form>