title: share method between controllers Laravel 5.2
body: <p>In several controllers i have to use the same method to show results as table with column sorting functionality:</p>
  
  <pre><code> public function showSearchResults(Request $req){
  
          $query=Service::where('title', $req-&gt;search);
  
          // Columns sorting 
          if ($req-&gt;has('order')){
              $order= $req-&gt;order=='asc' ? 'asc' : 'desc';
              $order_inverse=$req-&gt;order=='asc' ? 'desc' : 'asc';
          } else {
              $order='desc';
              $order_inverse='asc';
          }
  
           ...
  
  
          $url=$req-&gt;url().'?'.http_build_query($req-&gt;except('sortby','order','page'));
          $results=$query-&gt;with('type')-&gt;paginate(15)-&gt;appends($req-&gt;all());
  
  
          return View::make('services.search_results')
                      -&gt;with('results', $results)
                      -&gt;with('url',$url)
                      -&gt;with('sortby', $sortby)
                      -&gt;with('order', $order)
                      -&gt;with('order_inverse', $order_inverse);
  
      }
  </code></pre>
  
  <p>What is the best approach to avoid DRY in such case? </p>