Skip to content

Commit

Permalink
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Console/Commands/Purge.php
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ class Purge extends Command
*
* @var string
*/
protected $description = 'Purge all soft-deleted deleted records in the database. This will rewrite history for items that have been edited, or checked in or out. It will also reqrite history for users associated with deleted items.';
protected $description = 'Purge all soft-deleted deleted records in the database. This will rewrite history for items that have been edited, or checked in or out. It will also rewrite history for users associated with deleted items.';

/**
* Create a new command instance.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/ConsumablesController.php
Original file line number Diff line number Diff line change
@@ -165,7 +165,7 @@ public function getDataView($consumableId)
{
$consumable = Consumable::with(array('consumableAssignments'=>
function ($query) {
$query->orderBy('created_at', 'DESC');
$query->orderBy($query->getModel()->getTable().'.created_at', 'DESC');
},
'consumableAssignments.admin'=> function ($query) {
},
8 changes: 7 additions & 1 deletion app/Models/Company.php
Original file line number Diff line number Diff line change
@@ -80,7 +80,13 @@ private static function scopeCompanyablesDirectly($query, $column = 'company_id'
}

$table = ($table_name) ? DB::getTablePrefix().$table_name."." : '';
return $query->where($table.$column, '=', $company_id);

if(\Schema::hasColumn($query->getModel()->getTable(), $column)){
return $query->where($table.$column, '=', $company_id);
} else {
return $query->join('users as users_comp', 'users_comp.id', 'user_id')->where('users_comp.company_id', '=', $company_id);
}

}

public static function getIdFromInput($unescaped_input)

0 comments on commit f82ffe3

Please sign in to comment.