我在Laravel 5中有意想不到的重定向。所以我无法理解的情况。
我有控制器
public function getSABugs() {
$input = Input::all();
$search = null;
isset($input['search']) and !empty($input['search']) ? $search = Strip::filter($input['search']) : $search = null;
Cookie::get($this->filter_cookies['_trash']) ? $trash = true : $trash = null;
Cookie::get($this->filter_cookies['_sort']) ? $sort = Cookie::get($this->filter_cookies['_sort']) : $sort = 'desc';
Cookie::get($this->filter_cookies['_field_name']) ? $field_name = Cookie::get($this->filter_cookies['_field_name']) : $field_name = 'id';
//$model = SACountries::getWithRelation();
return view($this->view, ['models' => $this->getModels($sort, $field_name, $trash, $search)]);
}
当我在文本字段中键入一些文本并提交它时,我在视图中包含了一个帮助器。看起来很简单。
<?php
namespace App\Helpers;
use Illuminate\Support\Facades\Input;
class SearchAdmin extends Helper {
public static function render($link = null) {
$search = null;
Input::get("search") ? $search = Input::get("search") : $search = old("search");
return '
<!-- форма поиска -->
<div class="admin_search form-group">
<form action="'.config("zaks.zaksagency_root").'/'.$link.'" method="get">
<input type="hidden" name="_token" value="'.csrf_token().'">
<button class="btn btn-default" type="submit" name="search_submit">Поиск</button>
<div class="search_container col-sm-10">
<input type="text" class="form-control" id="search" name="search" placeholder="Что ищем ?" value="'.$search.'">
</div>
</form>
</div>
<!-- форма поиска -->
';
}
}
所以当我点击提交它在网站主页上重定向时。所以我尝试在配置中更改站点ulr传递,并在getSABugs中创建了dd函数。这不起作用:(э
但是1,2,3个字母中的查询正在通过,但每次都不会有更长的单词