insyaallah revisi done
This commit is contained in:
@@ -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']);
|
||||
|
||||
Reference in New Issue
Block a user