This commit is contained in:
snipe 2019-07-15 14:11:18 -07:00
commit f82ffe378c
3 changed files with 9 additions and 3 deletions

View file

@ -33,7 +33,7 @@ class Purge extends Command
* *
* @var string * @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. * Create a new command instance.

View file

@ -165,7 +165,7 @@ class ConsumablesController extends Controller
{ {
$consumable = Consumable::with(array('consumableAssignments'=> $consumable = Consumable::with(array('consumableAssignments'=>
function ($query) { function ($query) {
$query->orderBy('created_at', 'DESC'); $query->orderBy($query->getModel()->getTable().'.created_at', 'DESC');
}, },
'consumableAssignments.admin'=> function ($query) { 'consumableAssignments.admin'=> function ($query) {
}, },

View file

@ -80,7 +80,13 @@ final class Company extends SnipeModel
} }
$table = ($table_name) ? DB::getTablePrefix().$table_name."." : ''; $table = ($table_name) ? DB::getTablePrefix().$table_name."." : '';
if(\Schema::hasColumn($query->getModel()->getTable(), $column)){
return $query->where($table.$column, '=', $company_id); 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) public static function getIdFromInput($unescaped_input)