insyaallah revisi done

This commit is contained in:
Jagad R R
2025-01-23 17:46:38 +07:00
parent 6034c331c5
commit 3a01df56e9
32 changed files with 825 additions and 360 deletions
@@ -9,6 +9,7 @@ use App\Helpers\AuditTrailHelper;
use App\Models\Admin;
use App\Models\CostCentre;
use App\Models\Region;
use App\Models\Rayon;
class CabangController extends Controller
{
@@ -29,6 +30,25 @@ class CabangController extends Controller
return response()->json($cabang);
}
public function getRayonByCabang($cabangCode)
{
$cabang_id = Cabang::where('code', $cabangCode)->first()->id;
$rayon = Rayon::where('cabang_id', $cabang_id)->get(['code', 'name']);
return response()->json($rayon);
}
public function getCabangByRegionId($regionId)
{
$cabang = Cabang::where('region_id', $regionId)->get();
return response()->json($cabang);
}
public function getRayonByCabangId($cabangId)
{
$rayon = Rayon::where('cabang_id', $cabangId)->get();
return response()->json($rayon);
}
public function create()
{
$this->checkAuthorization(auth()->user(), ['cabang.create']);