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


PHP Address::findOrFail方法代码示例

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


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

示例1: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     $router->bind('client', function ($value, $route) {
         $hashids = new Hashids('MySecretSalt*(&^%$eo&*^%&r', 20);
         $id = $hashids->decode($value)[0];
         return Client::findOrFail($id);
     });
     $router->bind('bank', function ($value, $route) {
         $hashids = new Hashids('MySecretSalt*(&^%$eo&*^%&r', 20);
         $id = $hashids->decode($value)[0];
         return BankDetail::findOrFail($id);
     });
     $router->bind('address', function ($value, $route) {
         $hashids = new Hashids('MySecretSalt*(&^%$eo&*^%&r', 20);
         $id = $hashids->decode($value)[0];
         return Address::findOrFail($id);
     });
     $router->bind('property', function ($value, $route) {
         $hashids = new Hashids('MySecretSalt*(&^%$eo&*^%&r', 20);
         $id = $hashids->decode($value)[0];
         return Property::findOrFail($id);
     });
     $router->bind('agreement', function ($value, $route) {
         $hashids = new Hashids('MySecretSalt*(&^%$eo&*^%&r', 20);
         $id = $hashids->decode($value)[0];
         return RentalAgreement::findOrFail($id);
     });
     //
 }
开发者ID:arianpour,项目名称:AgentProV0.6,代码行数:36,代码来源:RouteServiceProvider.php

示例2: updateAddress

 public static function updateAddress($address)
 {
     try {
         $addressObj = Address::findOrFail($address['id']);
         $data = $addressObj->update(['lat' => $address['lat'], 'long' => $address['long']]);
     } catch (Exception $e) {
         $data = ['error' => 'Address not updated', 'message' => $e->getMessage()];
     }
     return $data;
     // dd(['$address' => $address, 'updated' => $data, 'addressObj' => $addressObj->toArray()]); exit;
 }
开发者ID:pierrestudios,项目名称:territory-api,代码行数:11,代码来源:Coordinates.php

示例3: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['contact11' => 'integer|min:1000000000|max:9999999999', 'contact12' => 'integer|max:9999999999', 'std_pincode' => 'integer']);
     $studentData = Student::findOrFail($id);
     $studentAdds = $studentData->addresses->flatten()->toArray();
     foreach ($studentAdds as $key => $value) {
         $studentAdd = $value;
     }
     $addressData = Address::findOrFail($studentAdd['id']);
     $addressData->update(['contact11' => $request->contact11, 'contact12' => $request->contact12, 'add1' => ucwords($request->add1), 'add2' => ucwords($request->add2), 'street' => ucwords($request->street), 'pincode' => $request->pincode]);
     return Redirect::route('student.show', ['student' => $addressData]);
 }
开发者ID:Khande1n,项目名称:ujval,代码行数:19,代码来源:AddressController.php

示例4: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     try {
         $address = Address::findOrFail($id);
     } catch (ModelNotFoundException $e) {
         throw new NotFoundHttpException();
     }
     return view('address.form_edit', compact('address'));
 }
开发者ID:masterpowers,项目名称:antVel,代码行数:15,代码来源:AddressesController.php

示例5: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $address = Address::findOrFail($id);
     // $address=Address::findOrFail($address->id);
     return view('editProperty', compact('address'));
 }
开发者ID:arianpour,项目名称:AgentProV0.2,代码行数:12,代码来源:PropertyController.php

示例6: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $staffData = User::findOrFail($id);
     if (isset($request->name)) {
         $staffData->update(['name' => $request->name, 'email' => $request->email, 'bday' => $request->bday]);
     }
     $staffAddresses = $staffData->addresses->flatten()->toArray();
     foreach ($staffAddresses as $key => $value) {
         $staffAddress = $value;
     }
     $addressData = Address::findOrFail($staffAddress['id']);
     $addressData->update(['contact11' => $request->contact11, 'contact12' => $request->contact12, 'add1' => $request->add1, 'add2' => $request->add2, 'street' => $request->street, 'pincode' => $request->pincode]);
     return Redirect::route('staff.show', ['staff' => $staffData]);
 }
开发者ID:Khande1n,项目名称:ujval,代码行数:21,代码来源:TeacherController.php

示例7: address

 public function address($id)
 {
     return Address::findOrFail($id);
 }
开发者ID:jedlicka82,项目名称:transferpraha,代码行数:4,代码来源:ApiController.php

示例8: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $address = Address::findOrFail($id);
     $address->delete();
     Session::flash('flash_message', 'Address successfully deleted!');
     return redirect()->action('ClientController@index');
 }
开发者ID:arianpour,项目名称:AgentProV0.2,代码行数:13,代码来源:AddressController.php

示例9: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function edit(Client $client)
 {
     $addressId = $client->addresses()->first()->id;
     $address = Address::findOrFail($addressId);
     return view('general.editAddress', compact('address', 'client'));
 }
开发者ID:arianpour,项目名称:AgentProV0.6,代码行数:12,代码来源:AddressController.php

示例10: addNote

 public function addNote(Request $request, $territoryId = null, $addressId = null)
 {
     if (!$this->hasAccess($request)) {
         return Response()->json(['error' => 'Access denied.'], 500);
     }
     if (empty($territoryId)) {
         return ['error' => 'Territory not found', 'message' => 'Territory not found'];
     }
     if (!empty($addressId)) {
         if (Gate::denies('create-notes')) {
             return Response()->json(['error' => 'Method not allowed'], 403);
         }
         // dd($this->unTransform($request->all(), 'note'));
         try {
             $transformedData = $this->unTransform($request->all(), 'note');
             // return ['data' => ['transformed'=>$transformedData, 'request' => $request->all()]];
             $address = Address::findOrFail($addressId);
             $data = $address && !empty($transformedData) ? $address->notes()->create($transformedData) : null;
         } catch (Exception $e) {
             $data = ['error' => 'Note not updated', 'message' => $e->getMessage()];
         }
     } else {
         $data = ['error' => 'Note not saved', 'message' => 'Note not saved'];
     }
     return ['data' => $data];
 }
开发者ID:pierrestudios,项目名称:territory-api,代码行数:26,代码来源:TerritoriesController.php

示例11: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['student' => 'string', 'email' => 'email', 'parentemail' => 'email']);
     $studentData = Student::findOrFail($id);
     $studentAdds = $studentData->addresses->flatten()->toArray();
     foreach ($studentAdds as $key => $value) {
         $studentAdd = $value;
     }
     $addressData = Address::findOrFail($studentAdd['id']);
     $studentData->update(['student' => ucwords($request->student), 'email' => $request->email, 'parentemail' => $request->parentemail]);
     return Redirect::route('student.show', ['student' => $studentData]);
 }
开发者ID:Khande1n,项目名称:ujval,代码行数:19,代码来源:StudentController.php

示例12: update

 /**
  * Update the specified resource in storage.
  * PUT /companies/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Request $request)
 {
     if (!$request->input('name_commercial')) {
         $request->merge(['name_commercial' => $request->input('name_fiscal')]);
     }
     $company = Company::findOrFail($id);
     $address = Address::findOrFail($company->address_id);
     $this->validate($request, Company::$rules);
     $request->merge(['alias' => $address->alias]);
     // Alias is mandatory!
     $this->validate($request, ['address' => Address::$rules]);
     $company->update($request->all());
     $request->merge($request->input('address'));
     // also replace
     $address->update($request->except(['address']));
     return redirect('companies')->with('info', l('This record has been successfully updated &#58&#58 (:id) ', ['id' => $id], 'layouts') . $request->get('name_commercial'));
 }
开发者ID:rogerapras,项目名称:aBillander,代码行数:24,代码来源:CompaniesController.php

示例13: updateAddress

 protected function updateAddress($addressArray)
 {
     $newAddress = $this->unTransform($addressArray, 'address');
     $address = Address::findOrFail($addressArray['id']);
     return $address->update($newAddress);
 }
开发者ID:pierrestudios,项目名称:territory-api,代码行数:6,代码来源:PrintController.php


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