コード例 #1
0
ファイル: AreaController.php プロジェクト: Lazybin/huisa
 /**
  *
  * @SWG\Api(
  *   path="/area",
  *   description="地区分类",
  *   @SWG\Operation(
  *     method="GET", summary="地区分类列表", notes="地区分类列表",
  *     type="Area",
  *     @SWG\ResponseMessage(code=0, message="成功"),
  *     @SWG\Parameter(
  *         name="pid",
  *         description="父id,默认为0---》获取省份",
  *         paramType="query",
  *         required=true,
  *         allowMultiple=false,
  *         type="integer",
  *         defaultValue=0
  *     )
  *   )
  * )
  */
 public function index(Request $request)
 {
     $pid = $request->input('pid', 0);
     $response = new BaseResponse();
     $area = Area::where('pid', $pid);
     $rows = $area->orderBy('id')->get()->toArray();
     $response->rows = $rows;
     $response->total = $area->count();
     return $response->toJson();
 }
コード例 #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $area = Area::find($id);
     $area->delete();
     $areas = Area::paginate();
     $notices = array("Registro Eliminado");
     return \Redirect::route('admin.areas.index')->with('notices', $notices);
 }
コード例 #3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     Log::info('Usuario editar id: ' . $id);
     $user = User::findOrFail($id);
     $roles = Rol::lists('desc_rol', "clave_rol");
     $areas = Area::lists('desc_area', 'clave_area');
     $puestos = Puesto::lists('desc_puesto', 'clave_puesto');
     return view('admin.users.editar', compact('user', 'roles', 'areas', 'puestos'));
 }