Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function scopeSearch($q)
- {
- return empty(request()->search) ? $q : $q->where('name', 'like', '%'.request()->search.'%');
- }
- <div class="col-sm-12 ">
- <input type="text" class="form-control" name="myInput" id="myInput" placeholder="Search...">
- </div>
- @foreach($users as $user)
- <tr id="{{$user->id}}" >
- <td>{!! $user->name !!}</td>
- <td>{!! $user->phone!!}</td>
- </tr>
- @endforeach
- public function index()
- {
- $users = User::search()->orderBy('name')->where('id',Auth::user()->id)->paginate(10);
- return view('user.index',compact('users'));
- }
Add Comment
Please, Sign In to add comment