62 lines
1.4 KiB
PHP
62 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* ZoneController.php
|
|
* @copyright 2022 beikeshop.com - All Rights Reserved
|
|
* @link https://beikeshop.com
|
|
* @author TL <mengwb@guangda.work>
|
|
* @created 2022-07-04 16:21:14
|
|
* @modified 2022-07-04 16:21:14
|
|
*/
|
|
|
|
namespace Beike\Shop\Http\Controllers;
|
|
|
|
use Beike\Models\Region;
|
|
use Beike\Repositories\CountryRepo;
|
|
use Beike\Repositories\ZoneRepo;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ZoneController extends Controller{
|
|
public function index(Request $request,int $countryId){
|
|
ZoneRepo::listByCountry($countryId);
|
|
$data = [
|
|
'zones' => ZoneRepo::listByCountry($countryId),
|
|
];
|
|
$data = hook_filter('zone.index.data',$data);
|
|
return json_success(trans('common.success'),$data);
|
|
}
|
|
/**
|
|
* Common: 获取全部的国家列表
|
|
* Author: wu-hui
|
|
* Time: 2023/08/25 16:57
|
|
* @param Request $request
|
|
* @return array
|
|
*/
|
|
public function countries(Request $request){
|
|
|
|
$brands = CountryRepo::autocomplete($request->get('name') ?? '', 0);
|
|
|
|
return json_success(trans('common.get_success'), $brands);
|
|
}
|
|
/**
|
|
* Common: 获取全部的区域分组
|
|
* Author: wu-hui
|
|
* Time: 2023/08/31 9:25
|
|
* @return array
|
|
*/
|
|
public function regionsAll(){
|
|
$list = Region::query()->select(['id','name'])->get();
|
|
|
|
return json_success(trans('common.get_success'), $list);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|