public function processReturn(Request $request) { $input = $request->all(); // Get the rental record $r = new Rental(); $r = $r->find($input['rentalNumber']); // Mark the movie as returned and set its new kiosk ID $inventory_id = $r['inventory_id']; $return_kiosk_id = $input['return_kiosk_id']; $this->markReturned($inventory_id, $return_kiosk_id); // Update the rental record with return date and location $r->return_kiosk_id = $return_kiosk_id; $r->returnDate = Carbon::now('America/New_York')->toDateTimeString(); $r->save(); // Get Kiosk info for return location $kiosk = Kiosk::find($return_kiosk_id); $msg = 'Your movie was returned to ' . $kiosk['location']; $this->setMessage($msg); return redirect('/'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $kiosk = Kiosk::find($id); if ($kiosk->delete($id)) { $this->setMessage('Successfully deleted the kiosk!'); } else { $this->setMessage('Could not delete the kiosk!', 'error'); } return redirect('/kiosks'); }