Guest User

Untitled

a guest
Dec 17th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. public function scopeSearch($q)
  2. {
  3. return empty(request()->search) ? $q : $q->where('name', 'like', '%'.request()->search.'%');
  4. }
  5.  
  6. <div class="col-sm-12 ">
  7. <input type="text" class="form-control" name="myInput" id="myInput" placeholder="Search...">
  8. </div>
  9. @foreach($users as $user)
  10. <tr id="{{$user->id}}" >
  11. <td>{!! $user->name !!}</td>
  12. <td>{!! $user->phone!!}</td>
  13. </tr>
  14. @endforeach
  15.  
  16. public function index()
  17. {
  18. $users = User::search()->orderBy('name')->where('id',Auth::user()->id)->paginate(10);
  19. return view('user.index',compact('users'));
  20. }
Add Comment
Please, Sign In to add comment