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


PHP Client::findOrFail方法代码示例

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


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

 /**
  * Remove the specified resource from storage.
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $client = Client::findOrFail($id);
     $name = $client->name . " " . $client->lastname;
     Client::destroy($id);
     return redirect(route('clients.index'))->with('message', 'Cliente ' . $name . ' eliminado corectamente');
 }
开发者ID:edwardricardo,项目名称:zenska,代码行数:12,代码来源:ClientController.php

示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $client = Client::findOrFail($id);
     $client->delete();
     flash()->success('Client Deleted!');
     return redirect()->route('clients.index');
 }
开发者ID:laravelista,项目名称:kyle,代码行数:13,代码来源:ClientController.php

示例4: edit

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

示例5: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  *
  * @return Response
  */
 public function update($id, Request $request)
 {
     $client = Client::findOrFail($id);
     $client->update($request->all());
     Session::flash('flash_message', 'Client updated!');
     return redirect('admin/client');
 }
开发者ID:thibaultvanc,项目名称:organit,代码行数:14,代码来源:ClientController.php

示例6: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $client = Client::findOrFail($id);
     $bankDetailId = $client->bankdetails()->first()->id;
     $bankDetail = BankDetail::findOrFail($bankDetailId);
     return view('editBankDetail', compact('bankDetail', 'client'));
 }
开发者ID:arianpour,项目名称:AgentProV0.5,代码行数:13,代码来源:BankDetailController.php

示例7: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Request $request)
 {
     $client = Client::findOrFail($id);
     $this->validate($request, ['first_name' => 'required', 'last_name' => 'required', 'company_name' => 'required', 'email' => 'required', 'address' => '', 'zipcode' => '', 'city' => '', 'primary_number' => '', 'secondary_number' => '', 'industry' => '', 'company_type' => '', 'fk_user_id' => 'required']);
     $input = $request->all();
     //dd($input);
     $client->fill($input)->save();
     Session::flash('flash_message', 'Client successfully updated!');
     return redirect()->back();
 }
开发者ID:tykus,项目名称:RockCRM,代码行数:16,代码来源:ClientsController.php

示例8: create

 /**
  * Show the form for creating a new resource.
  * @return Response
  * @internal param StorePreAgreementPostRequest $request
  */
 public function create()
 {
     Session::put('client_id', Input::get('tenant'));
     Session::put('owner_id', Input::get('owner'));
     $propertyList = Client::findOrFail(Input::get('owner'))->property()->get();
     $adds = array();
     foreach ($propertyList as $property) {
         array_push($adds, $property->addresses()->get()->lists('unit_street', 'id'));
     }
     return view('agreement.addAgreement', compact('adds'));
 }
开发者ID:arianpour,项目名称:AgentProV0.6,代码行数:16,代码来源:RentalAgreementController.php

示例9: stepOne

 /**
  * Show the form for creating a new resource.
  *
  * @param StoreAddRAgreementStepOnePostRequest $request
  * @return Response
  */
 public function stepOne(StoreAddRAgreementStepOnePostRequest $request)
 {
     Session::put('client_id', $request->tenant);
     Session::put('owner_id', $request->owner);
     $propertyList = Client::findOrFail($request->owner)->property()->get();
     $adds = array();
     foreach ($propertyList as $property) {
         array_push($adds, $property->addresses()->get()->lists('unit_street', 'id'));
     }
     return view('addAgreement', compact('adds'));
 }
开发者ID:arianpour,项目名称:AgentProV0.2,代码行数:17,代码来源:RentalAgreementController.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store($client_id, Request $request)
 {
     $quote = new Quote();
     $client = Client::findOrFail($client_id);
     $quote_count = $client->quotes()->count();
     $quote->client_specific_id = $quote_count + 1;
     $quote->client_id = $client_id;
     $quote->user_id = Auth::user()->id;
     $quote->issue_date = $request->issue_date;
     $quote->amount = $request->amount;
     $quote->is_accepted = 0;
     $quote->save();
     return redirect('clients/' . $client_id);
 }
开发者ID:naughton-and-ross,项目名称:clientapp,代码行数:20,代码来源:QuoteController.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store($client_id, Request $request)
 {
     $invoice = new Invoice();
     $client = Client::findOrFail($client_id);
     $invoice_count = $client->invoices()->count();
     $invoice->client_specific_id = $invoice_count + 1;
     $invoice->client_id = $client_id;
     $invoice->user_id = Auth::user()->id;
     $invoice->issue_date = $request->issue_date;
     $invoice->amount = $request->amount;
     $invoice->due_date = $request->due_date;
     $invoice->is_paid = 0;
     $invoice->save();
     return redirect('clients/' . $client_id);
 }
开发者ID:naughton-and-ross,项目名称:clientapp,代码行数:21,代码来源:InvoiceController.php

示例12: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $client = Client::findOrFail($id);
     $client->delete();
 }
开发者ID:zbtaylor,项目名称:acl-checker,代码行数:11,代码来源:ClientController.php

示例13: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     // delete
     $client = Client::findOrFail($id);
     $client->delete();
     Session::flash('message', 'Client successfully deleted!');
     return Redirect::to('clients');
 }
开发者ID:shirishmore,项目名称:timesheet,代码行数:14,代码来源:ClientController.php

示例14: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $owner = Client::findOrFail($id);
     $owner->addresses()->delete();
     $owner->bankDetails()->delete();
     $propertyd = $owner->property()->get();
     foreach ($propertyd as $item) {
         $item->addresses()->delete();
     }
     $owner->property()->delete();
     $owner->delete();
     Session::flash('flash_message', 'Owner successfully deleted!');
     return redirect()->action('OwnerController@index');
 }
开发者ID:arianpour,项目名称:AgentProV0.5,代码行数:20,代码来源:OwnerController.php

示例15: destroy

 public function destroy($id)
 {
     $client = Client::findOrFail($id);
     $client->delete();
     return redirect('client');
 }
开发者ID:ecortez3,项目名称:CCO,代码行数:6,代码来源:ClientController.php


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