mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 22:07:29 -08:00
Added checkin on delete to API
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
5823197e6f
commit
27ba641aa5
|
@ -780,9 +780,16 @@ class AssetsController extends Controller
|
|||
if ($asset = Asset::find($id)) {
|
||||
$this->authorize('delete', $asset);
|
||||
|
||||
DB::table('assets')
|
||||
->where('id', $asset->id)
|
||||
->update(['assigned_to' => null]);
|
||||
if ($asset->assignedTo) {
|
||||
|
||||
$target = $asset->assignedTo;
|
||||
$checkin_at = date('Y-m-d H:i:s');
|
||||
$originalValues = $asset->getRawOriginal();
|
||||
event(new CheckoutableCheckedIn($asset, $target, auth()->user(), 'Checkin on delete', $checkin_at, $originalValues));
|
||||
DB::table('assets')
|
||||
->where('id', $asset->id)
|
||||
->update(['assigned_to' => null]);
|
||||
}
|
||||
|
||||
$asset->delete();
|
||||
|
||||
|
|
Loading…
Reference in a new issue