mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 06:17:28 -08:00
* Added company_id to consumables_users table * Added logic to manage when a pivot table doesn't have the column company_id trough a join with users * Remove a migration that tries to fix this problem, but is not longer necessary
This commit is contained in:
parent
e1b33f3087
commit
d409be6d43
|
@ -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) {
|
||||||
},
|
},
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue