mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -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)) {
|
if ($asset = Asset::find($id)) {
|
||||||
$this->authorize('delete', $asset);
|
$this->authorize('delete', $asset);
|
||||||
|
|
||||||
DB::table('assets')
|
if ($asset->assignedTo) {
|
||||||
->where('id', $asset->id)
|
|
||||||
->update(['assigned_to' => null]);
|
$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();
|
$asset->delete();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue