dimanche 4 septembre 2016

unexpectable redirect in Laravel

I have unexpectable redirect in Laravel 5. So situation which I cannot understand.

I have controller

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)]);

}

I have a helper included in the view when I typing some text in the text field and submiting It. Looks simple.

<?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>
            <!-- форма поиска -->
        ';

    }

}

So when I click submit It redirecting on site main page. So I tryied to change site ulr passes in the config and made dd function in the getSABugs. It's not working :(



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire