Ejemplo n.º 1
0
 /**
  * Query builder scope to order on company
  *
  * @param  Illuminate\Database\Query\Builder  $query  Query builder instance
  * @param  text                              $order    	 Order
  *
  * @return Illuminate\Database\Query\Builder          Modified query builder
  */
 public function scopeOrderCategory($query, $order)
 {
     return $query->join('categories', 'consumables.category_id', '=', 'categories.id')->orderBy('categories.name', $order);
 }
Ejemplo n.º 2
0
 /**
  * Query builder scope to order on location
  *
  * @param  Illuminate\Database\Query\Builder  $query  Query builder instance
  * @param  text                              $order       Order
  *
  * @return Illuminate\Database\Query\Builder          Modified query builder
  * TODO: Extend this method out for checked out assets as well. Right now it
  * only checks the location name related to rtd_location_id
  */
 public function scopeOrderLocation($query, $order)
 {
     return $query->join('locations', 'locations.id', '=', 'assets.rtd_location_id')->orderBy('locations.name', $order);
 }