Разрешить 4 буквы
This commit is contained in:
parent
2e68a2e624
commit
60ae6b344a
|
@ -26,14 +26,14 @@ class SearchController extends Controller
|
||||||
$error = 'В названии разрешены только буквы.';
|
$error = 'В названии разрешены только буквы.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($term) && mb_strlen($term) > 4) {
|
if (!empty($term) && mb_strlen($term) >= 4) {
|
||||||
$term = mb_strtolower($term);
|
$term = mb_strtolower($term);
|
||||||
$options = Game::where(DB::raw('LOWER(title)'), 'LIKE', '%'.$term.'%')->get();
|
$options = Game::where(DB::raw('LOWER(title)'), 'LIKE', '%'.$term.'%')->get();
|
||||||
if ($options->count() === 1) {
|
if ($options->count() === 1) {
|
||||||
$page = new Wikipage($options[0]);
|
$page = new Wikipage($options[0]);
|
||||||
$response = $page->getContent();
|
$response = $page->getContent();
|
||||||
}
|
}
|
||||||
} elseif (!empty($term) && mb_strlen($term) <= 4) {
|
} elseif (!empty($term) && mb_strlen($term) < 4) {
|
||||||
$error = 'Слишком короткая строка поиска, нужно не менее 4 букв.';
|
$error = 'Слишком короткая строка поиска, нужно не менее 4 букв.';
|
||||||
}
|
}
|
||||||
return view('welcome', [
|
return view('welcome', [
|
||||||
|
|
Loading…
Reference in a new issue