lundi 14 mars 2016

How to format request url in lavavel blade?

I have been searching for long time to make work using prettus/l5-repository but none of things that I tried worked. My problem is that I need to format get request url like

?search=name:John Doe;email:john@gmail.com

when user click submit button.

I have tried to replace request()->query->all() to "search"=>"name:John Doe;email:john@gmail.com" but it did not work. I believe request get url should be that format.. How to format request url like that can anyone help me ?

Controller index()

$paginator = $this->Repository->scopeQuery(function ($query) {
    return $query->orderBy('updated_at', 'desc');
})->paginate($limit, ['*']);

$paginator->appends(request()->query->all()); //Append Url query

Blade

   <form method="GET" action="{{Request::fullUrl()}}">
        <div class="btn-group pull-left" style="padding-left: 0;">
            <a href="{{request()->url().'/create'}}" class="btn btn-success"><span
                        class="glyphicon glyphicon-plus" aria-hidden="true"></span>Create Case</a>
        </div>

        <div id="filterDropDown" class="btn-group col-md-3">
            <button type="button" class="btn btn-info dropDownTitle">Filter</button>
            <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"
                    aria-haspopup="true" aria-expanded="false">
                <span class="caret"></span>
                <span class="sr-only">Toggle Dropdown</span>
            </button>
            <ul class="dropdown-menu" style="left:14px">
                <li value="All"><a  href="#">All Record</a></li>
                <li value="Waiting"><a  href="#">Waiting</a></li>
                <li value="Resolved"><a  href="#">Resolved</a></li>
            </ul>
            <input type="text" name="status" value="{{Request::get('search')}}"  style="visibility: hidden"/>
        </div>

        <div class="input-group col-md-7 pull-right">
            <input type="text" name="title" class="form-control" id="basic-url"
                   aria-describedby="basic-addon3" value="{{Request::get('search')}}"
                   placeholder="Search by Title or Case number">
            <span class="input-group-btn">
                <button class="btn btn-default" type="submit">Search</button>
            </span>
        </div>

        <div class="clear"></div>
    </form>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire