Set image to null if model is deleted

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-08-28 14:23:49 +01:00
parent e8da7e2df2
commit 94c981e22c

View file

@ -202,6 +202,7 @@ class AssetModelsController extends Controller
if ($model->image) { if ($model->image) {
try { try {
Storage::disk('public')->delete('models/'.$model->image); Storage::disk('public')->delete('models/'.$model->image);
$model->update(['image' => null]);
} catch (\Exception $e) { } catch (\Exception $e) {
Log::info($e); Log::info($e);
} }