本文整理汇总了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);
});
//
}
示例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');
}
示例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');
}
示例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'));
}
示例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');
}
示例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'));
}
示例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();
}
示例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'));
}
示例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'));
}
示例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);
}
示例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);
}
示例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();
}
示例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');
}
示例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');
}
示例15: destroy
public function destroy($id)
{
$client = Client::findOrFail($id);
$client->delete();
return redirect('client');
}