当前位置: 首页>>代码示例>>PHP>>正文


PHP Phone::find方法代码示例

本文整理汇总了PHP中Phone::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Phone::find方法的具体用法?PHP Phone::find怎么用?PHP Phone::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phone的用法示例。


在下文中一共展示了Phone::find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: borrar_telefono

 public function borrar_telefono()
 {
     $id = Input::get('idedit');
     $telefono = Phone::find($id);
     if ($telefono->delete()) {
         Session::flash('message', 'Eliminado correctamente');
         Session::flash('class', 'success');
     } else {
         Session::flash('message', 'Ha ocurrido un error, intentelo nuevamente');
         Session::flash('class', 'danger');
     }
     return Redirect::to('telefono');
 }
开发者ID:bmrpas,项目名称:SHREDDER,代码行数:13,代码来源:TelefonoController.php

示例2: selfUpdatePhone

 /**
  * Update (basically create new one but with provided id) mine phone
  * This functions requires token - user must validate phone number via sms
  * @param $id
  *
  * @return Response
  */
 public function selfUpdatePhone($id)
 {
     $token = Input::get('token');
     $smsEntry = SMS::where('token', $token)->orderBy('id')->first();
     if (!$smsEntry) {
         return $this->respondInsufficientPrivileges('user.invalid-token');
     }
     if (!$smsEntry->verified) {
         return Response::json(['error' => ['message' => 'Your number is not yet verified. Please re-register', 'status' => 1]], 403);
     }
     $phone = Phone::find($id);
     if (!$phone) {
         return $this->respondNotFound('user.phone-not-found');
     }
     $phone->fill(['number' => $smsEntry->phone]);
     if ($phone->save()) {
         $smsEntry->delete();
         //			$user = Auth::user();
         return $this->respond($phone);
         //			return $user->phones;
     }
     return $this->respondNotFound('user.phone-not-found');
 }
开发者ID:SenhorBardell,项目名称:yol,代码行数:30,代码来源:UsersController.php

示例3: function

$contactList->put("/phones/:id", function ($id) use($contactList) {
    $phone = $contactList->request->params('phone');
    $editPhone = Phone::find($id);
    $editPhone->phone = $phone;
    if ($editPhone->save()) {
        $data['msg'] = 'Phone saved successfully!';
        $data['id'] = $editPhone->id;
    } else {
        $data['msg'] = 'An error occurred while saving the phone!';
    }
    $contactList->response()->header('Content-Type', 'application/json');
    echo json_encode($data);
});
// Delete phone
$contactList->delete("/phones/:id", function ($id) use($contactList) {
    $phone = Phone::find($id);
    if ($phone->delete()) {
        $data['msg'] = 'Phone deleted successfully!';
    } else {
        $data['msg'] = 'An error occurred while deleting the phone!';
    }
    $contactList->response()->header('Content-Type', 'application/json');
    echo json_encode($data);
});
// Get all address to one contact
$contactList->get("/contact/:id/address", function ($id) use($contactList) {
    $addresses = Address::where('contactId', '=', $id)->get();
    $contactList->response()->header('Content-Type', 'application/json');
    echo json_encode(objectToArray(json_decode($addresses)));
});
// Add new address
开发者ID:vitorm11,项目名称:contactlist,代码行数:31,代码来源:index.php


注:本文中的Phone::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。