some cleanup

This commit is contained in:
spencerrlongg
2025-08-11 21:07:08 -05:00
parent 6159ee8c2c
commit 78ca1d1335
7 changed files with 5 additions and 11 deletions

View File

@@ -223,7 +223,7 @@ class CategoriesController extends Controller
} catch (\Throwable $e) {
report($e);
return response()->json(
Helper::formatStandardApiResponse('error', null, 'something went wrong, call support')
Helper::formatStandardApiResponse('error', null, trans('general.something_went_wrong'))
);
}

View File

@@ -199,12 +199,10 @@ class ManufacturersController extends Controller
} catch (ModelStillHasChildren $e) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/manufacturers/message.assoc_users')));
} catch (\Exception $e) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'something went wrong'));
return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.something_went_wrong')));
}
return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/manufacturers/message.delete.success')));
}
/**

View File

@@ -207,7 +207,7 @@ class SuppliersController extends Controller
} catch (ModelStillHasLicenses $e) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/suppliers/message.delete.assoc_licenses', ['licenses_count' => (int) $supplier->licenses_count])));
} catch (\Throwable $e) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'something went wrong'));
return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.something_went_wrong')));
}
return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/suppliers/message.delete.success')));

View File

@@ -17,7 +17,6 @@ class BulkCategoriesController extends Controller
{
public function destroy(Request $request)
{
// Authorize the user to delete categories
$this->authorize('delete', Category::class);
$errors = [];

View File

@@ -17,7 +17,6 @@ class BulkManufacturersController extends Controller
{
public function destroy(Request $request)
{
// hm, we actually probably need to do this on a per model basis below, but that makes this a little dirtier so leaving like this for now.
$this->authorize('delete', Manufacturer::class);
$errors = [];

View File

@@ -13,7 +13,6 @@ class BulkSuppliersController extends Controller
{
public function destroy(Request $request)
{
// Authorize the user to delete suppliers
$this->authorize('delete', Supplier::class);
$errors = [];

View File

@@ -173,18 +173,17 @@ class ManufacturersController extends Controller
} catch (ModelStillHasChildren $e) {
return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.assoc_users'));
} catch (\Exception $e) {
return redirect()->route('manufacturers.index')->with('error', 'something went wrong');
return redirect()->route('manufacturers.index')->with('error', trans('general.something_went_wrong'));
}
// Soft delete the manufacturer if active, permanent delete if is already deleted
// do we really want to do that?...
// commenting it out for now because it's weird
// commenting it out for now because it's weird...
//if ($manufacturer->deleted_at === null) {
// $manufacturer->delete();
//} else {
// $manufacturer->forceDelete();
//}
// Redirect to the manufacturers management page
return redirect()->route('manufacturers.index')->with('success', trans('admin/manufacturers/message.delete.success'));
}