By clicking on userid in the table column i want to asc or desc using php controller can it be done?

1. IN CONTROLLER

```
      if(isset($_GET['sortOrder'])){    
          $reverse = ($_GET['sortOrder'] == 'desc') ? 'desc' : 'asc';    
          $okdata = DB::table('adminblogs')->orderBy('user_id', $reverse)->get();    
          return view("adminblog.index")->with("adminblogs", $okdata);
      }

```
2. IN VIEW

```
      <table id="example" class="table table-bordered">
        <thead> <tr>
                        <th>ID</th>
                        <th>TITLE</th>

                        <th><a id="sort" href="{{url('admin?sortOrder=asc')}}">USER ID</a></th>
                        <th>DELETE</th>
                    </tr>
                </thead>
                <tbody>

            @foreach($adminblogs as $blog)                  
                <tr>
                    <td>{{ $blog->id }}</td>
                    <td>{{ $blog->title }}</td>
                    <td>{{ $blog->user_id }}</td>
                    <td>
                    @if(Auth::id() == $blog->user_id)
                    <a href="{{ url('admin/destroy/'.$blog->id.'/'.$blog->user_id) }}" class="btn btn-danger" >DELETE</a>
                    @else
                        <a href="{{ url('admin/destroy/'.$blog->id.'/'.$blog->user_id) }}" class="disabled btn btn-danger" >DELETE</a>
                    @endif

                    </td>
                </tr>

            @endforeach

```