12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace App\Http\Controllers\Front\Addresses;
- use App\Http\Controllers\Controller;
- use App\Shop\Countries\Repositories\CountryRepository;
- use App\Shop\Countries\Repositories\Interfaces\CountryRepositoryInterface;
- class CountryStateController extends Controller
- {
- private $countryRepo;
-
- public function __construct(CountryRepositoryInterface $countryRepository)
- {
- $this->countryRepo = $countryRepository;
- }
-
- public function index($countryId)
- {
- $country = $this->countryRepo->findCountryById($countryId);
- $countryRepo = new CountryRepository($country);
- $data = $countryRepo->listStates();
- return response()->json(compact('data'));
- }
- }
|