/** * 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); }); // }
/** * Update the specified resource in storage. * * @param int $id * @param StoreBankDetailPostRequest $request * @return Response */ public function update($id, StoreBankDetailPostRequest $request) { $bankdetail = BankDetail::findOrFail($id); $input = $request->all(); $bankdetail->fill($input)->save(); Session::flash('flash_message', 'Bank Details successfully Updated!'); return redirect()->back(); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit(Client $client) { $bankDetailId = $client->bankdetails()->first()->id; $bank = BankDetail::findOrFail($bankDetailId); return view('general.editBankDetail', compact('bank', 'client')); }