3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-08-20 04:07:35 +00:00
Files
snipe-it/app/Actions/StatusLabels/DestroyStatuslabelAction.php
2026-07-04 18:40:54 +01:00

26 lines
501 B
PHP

<?php
namespace App\Actions\StatusLabels;
use App\Exceptions\ItemStillHasAssets;
use App\Models\Statuslabel;
class DestroyStatuslabelAction
{
/**
* @throws ItemStillHasAssets
*/
public static function run(Statuslabel $statuslabel): bool
{
$statuslabel->loadCount(['assets as assets_count']);
if ($statuslabel->assets_count > 0) {
throw new ItemStillHasAssets($statuslabel);
}
$statuslabel->delete();
return true;
}
}