mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
updates all assets assigned to user with new location
This commit is contained in:
parent
4cd4a936d8
commit
595dad0f18
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Models\Asset;
|
||||||
use App\Models\Department;
|
use App\Models\Department;
|
||||||
use App\Models\Group;
|
use App\Models\Group;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
@ -390,6 +391,10 @@ class LdapSync extends Command
|
||||||
$user->location_id = $location->id;
|
$user->location_id = $location->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$assets = Asset::whereColumn('assigned_to', '=', $user->id)->get();
|
||||||
|
foreach($assets as $asset){
|
||||||
|
$asset->location = $user->location_id;
|
||||||
|
}
|
||||||
|
|
||||||
$user->ldap_import = 1;
|
$user->ldap_import = 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue