67 lines
1.2 KiB
PHP
67 lines
1.2 KiB
PHP
<?php
|
|
namespace App\Domains\Area\Http\Controllers;
|
|
|
|
use App\Core\Controller;
|
|
use Illuminate\Http\Request;
|
|
use App\Domains\Area\Repositories\AreaRepository;
|
|
|
|
class AreaController extends Controller
|
|
{
|
|
protected $request;
|
|
protected $areaRepository;
|
|
|
|
/**
|
|
* 构造函数,自动注入.
|
|
*/
|
|
public function __construct(Request $request, AreaRepository $areaRepository)
|
|
{
|
|
$this->request = $request;
|
|
$this->areaRepository = $areaRepository;
|
|
}
|
|
|
|
/**
|
|
* 列表.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function index()
|
|
{
|
|
$conditions['parent_id'] = $this->request->get('parent_id', 0);
|
|
|
|
$areas = $this->areaRepository->withConditions($conditions)->applyConditions()->get();
|
|
|
|
return res($areas, '地区列表', 201);
|
|
}
|
|
|
|
|
|
/**
|
|
* 创建.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function create()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* 编辑.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function update($id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* 删除.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function destroy()
|
|
{
|
|
//
|
|
}
|
|
}
|