當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。