/**
  * Returns a JSON response that contains the assets association with the
  * selected location, to be used by the location detail view.
  *
  * @todo This is broken for accessories and consumables.
  * @todo This is a very naive implementation. Should clean this up with query scopes.
  * @author [A. Gianotto] [<*****@*****.**>]
  * @see LocationsController::getView() method that creates the display view
  * @param int $locationID
  * @since [v1.8]
  * @return View
  */
 public function getDataViewAssets($locationID)
 {
     $location = Location::find($locationID)->load('assignedassets.model');
     $assets = Asset::AssetsByLocation($location);
     if (Input::has('search')) {
         $assets = $assets->TextSearch(e(Input::get('search')));
     }
     $assets = $assets->get();
     $rows = array();
     foreach ($assets as $asset) {
         $rows[] = array('name' => (string) link_to(config('app.url') . '/hardware/' . $asset->id . '/view', e($asset->showAssetName())), 'asset_tag' => e($asset->asset_tag), 'serial' => e($asset->serial), 'model' => e($asset->model->name));
     }
     $data = array('total' => $assets->count(), 'rows' => $rows);
     return $data;
 }