Optimize code

This commit is contained in:
Daeng Deni Mardaeni
2024-08-13 11:54:42 +07:00
parent 5c4285c77e
commit e950b73b44
42 changed files with 1064 additions and 991 deletions

View File

@@ -3,6 +3,7 @@
namespace Modules\Lpj\Http\Controllers;
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel;
use Modules\Lpj\Exports\BranchExport;
@@ -29,7 +30,7 @@
return redirect()
->route('basicdata.branch.index')
->with('success', 'Branch created successfully');
} catch (\Exception $e) {
} catch (Exception $e) {
return redirect()
->route('basicdata.branch.create')
->with('error', 'Failed to create branch');
@@ -60,7 +61,7 @@
return redirect()
->route('basicdata.branch.index')
->with('success', 'Branch updated successfully');
} catch (\Exception $e) {
} catch (Exception $e) {
return redirect()
->route('basicdata.branch.edit', $id)
->with('error', 'Failed to update branch');
@@ -76,7 +77,7 @@
$branch->delete();
echo json_encode(['success' => true, 'message' => 'Branch deleted successfully']);
} catch (\Exception $e) {
} catch (Exception $e) {
echo json_encode(['success' => false, 'message' => 'Failed to delete branch']);
}
}