本文整理汇总了PHP中Area::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Area::find方法的具体用法?PHP Area::find怎么用?PHP Area::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Area
的用法示例。
在下文中一共展示了Area::find方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: convert
public static function convert($row)
{
$subarea = new Area();
$subarea->id = $row['id'];
$subarea->nome = $row['nome'];
$subarea->area = Area::find($row['area_id']);
return $subarea;
}
示例2: put_area
public static function put_area($codarea, $recibido)
{
$area = Area::find($codarea);
$area->add_data($recibido);
$respuesta = new stdClass();
$respuesta->result = $area->save();
if ($respuesta->result) {
$respuesta->mensaje = "Actualizado correctamente.";
$respuesta->area = $area;
} else {
$respuesta->mensaje = "Error al momento de actualizar.";
}
return $respuesta;
}
示例3: update
/**
* Update the specified resource in storage.
* PUT /area/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
$Area = Area::find($id);
if (!$Area) {
return Response::json(['id' => $id], 404);
}
$V = Validator::make(Input::all(), ['name' => 'required|string', 'last_updated' => 'integer']);
if ($V->fails()) {
return Response::json($V->messages()->all(), 400);
}
$Area->name = Input::get('name');
if (Input::has('last_updated')) {
$Area->updated_at = new DateTime(date('c', round(Input::get('last_updated') / 1000)));
} else {
$Area->touch();
}
if ($Area->save()) {
return Response::json($Area->toArray(), 200);
}
}
示例4: sendSibelForm
protected function sendSibelForm()
{
// fixme:
$city = City::find($this->getPreparedItem('id_city'));
if ($city) {
$region = Region::find($city->id_region);
$area = Area::find($region->id_area);
}
$client = new SibelClient();
$client->setLastName($this->preparedData['last_name']);
$client->setFirstName($this->preparedData['first_name']);
$client->setMiddleName($this->preparedData['patronymic_name']);
$client->setPhone($this->preparedData['phone_number']);
$client->setProject($this->getSibelProject());
$client->setCreatedDate(date('Y-m-d H:i:s'));
if (isset($area) && $area && $city) {
$client->setDescription($area->title_ru);
$client->setComment($city->title_ru);
}
$orderCode = $client->registerShortApplication();
$this->preparedData['sibel_request'] = $client->getXml();
$this->preparedData['sibel_response'] = $orderCode;
}
示例5: destroy
/**
* Remove the specified resource from storage.
* DELETE /area/{id}
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$area = Area::find($id)->delete();
if (is_null($area)) {
$class = 'error';
$message = 'Record does not exist.';
} else {
$class = 'success';
$message = 'Record successfully deleted.';
}
return Redirect::route('area.index')->with('class', $class)->with('message', $message);
}
示例6: submit_disable_area
public function submit_disable_area()
{
if (Auth::check()) {
$data["inside_url"] = Config::get('app.inside_url');
$data["user"] = Session::get('user');
// Verifico si el usuario es un Webmaster
if ($data["user"]->idrol == 1) {
$area_id = Input::get("area_id");
$url = "areas/edit_area" . "/" . $area_id;
$area = Area::find($area_id);
$usuarios_activos = User::searchPersonalActivoByIdArea($area_id)->get();
if (count($usuarios_activos) == 0) {
$area->delete();
Session::flash('message', 'Se inhabilitó correctamente el área.');
return Redirect::to('areas/list_areas');
} else {
Session::flash('error', 'El área cuenta con personal activo. Acción no realizada.');
}
return Redirect::to($url);
} else {
return View::make('error/error', $data);
}
} else {
return View::make('error/error', $data);
}
}
示例7: postAreaEdit
public function postAreaEdit($AreaId)
{
$rules = array('name' => 'required|min:2|unique:area,name,' . $AreaId, 'code' => 'required|unique:area,code,' . $AreaId);
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('branch/area-edit/' . $AreaId)->withErrors($validator)->withInput();
}
$area = Area::find($AreaId);
$area->name = Input::get('name');
$area->code = Input::get('code');
$area->save();
return Redirect::to('branch/area')->with('success', '区域更新成功!');
}
示例8: postCambiarestado
/**
* Changed the specified resource from storage.
* POST /area/cambiarestado
*
* @return Response
*/
public function postCambiarestado()
{
if (Request::ajax()) {
$area = Area::find(Input::get('id'));
$area->estado = Input::get('estado');
$area->save();
return Response::json(array('rst' => 1, 'msj' => 'Registro actualizado correctamente'));
}
}
示例9: edit
/**
* Show the form for editing the specified area.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$area = Area::find($id);
return View::make('areas.edit', compact('area'));
}
示例10: destroy
/**
* Remove the specified resource from storage.
* DELETE /areas/{id}
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$area = Area::find($id);
$area->delete();
return Redirect::to('allAreas');
}
示例11: getValorReporte
public function getValorReporte($columna)
{
if (str_contains($columna, '.')) {
$columna = explode('.', $columna)[1];
}
$valor = $this->{$columna};
switch ($columna) {
case "estado_id":
return Estado::find($valor)->nombre;
case "tipo_ayuda_id":
return TipoAyuda::find($valor)->nombre;
case "area_id":
return Area::find($valor)->nombre;
case "beneficiario_id":
$benef = \Oracle\Beneficiario::find($valor);
if (is_null($benef)) {
return $valor;
}
return $benef->nombre;
case "requerimiento_id":
return Requerimiento::find($valor)->nombre;
case "estatus":
return static::$estatusArray[$valor];
case "recepcion_id":
return Recepcion::find($valor)->nombre;
case "especial_mes":
return Solicitud::$array_meses[$valor];
case "especial_edad":
// $persona_edad = Persona::find($valor);
// if (is_null($persona_edad)) {
return $valor;
// }
// return $persona->nombre;
// }
// return $persona->nombre;
case "sexo":
if ($valor == '') {
return "No Seleccionado";
}
return Solicitud::$cmbsexo[$valor];
}
}