/** * Store a newly created resource in storage. * * @param StoreAddRentalAgreementPostRequest $request * @return Response */ public function store(StoreAddRentalAgreementPostRequest $request) { $agreement = new RentalAgreement(array('client_id' => $request->client_id, 'owner_id' => $request->owner_id, 'property_id' => $request->property_id, 'user_id' => Auth::user()->id, 'dateOfAgreement' => $request->dateOfAgreement, 'commencingDate' => $request->commencingDate, 'expireDate' => $request->expireDate, 'rentalAmount' => $request->rentalAmount, 'rentalDeposit' => $request->rentalDeposit, 'utilitiesDeposit' => $request->utilitiesDeposit, 'otherDeposit' => $request->otherDeposit, 'premiseUse' => $request->premiseUse)); $agreement->save(); Session::flash('flash_message', 'Agreement successfully added! '); return view('review'); }
/** * 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); }); // }
/** * Remove the specified resource from storage. * * @param RentalAgreement $agreement * @return Response * @throws \Exception * @internal param int $id */ public function destroy(RentalAgreement $agreement) { $agreement->delete(); Session::flash('flash_message', 'Agreement successfully deleted!'); return redirect()->action('RentalAgreementController@index'); }