public function delete($id) { $retailer = Retailer::find($id); // Title $title = 'Delete this outlet will delete outlet relate.'; // Show the page return View::make('admin/retailers/delete', compact('retailer', 'title')); }
public function postBook() { $response = null; $Bill = null; $spa_id = Input::get('spaName'); $outlet_id = Input::get('spaLocation'); $service_id = Input::get('serviceName'); $apptDate = Input::get('apptDate'); $apptTime = Input::get('timeSlot'); if (!empty($spa_id) && !empty($outlet_id) && !empty($service_id) && !empty($apptDate)) { $apptDateTime = strtotime($apptDate . " " . $apptTime); $service = Service::find($service_id); $response = array("retailerName" => Retailer::find($spa_id)->name, "outletName" => Outlet::find($outlet_id)->name, "serviceName" => $service->name . " (" . $service->time_operate . " mins)", "apptDateTime" => $apptDateTime, "price" => $service->price); if (!Auth::user()) { return View::make('site/user/book', compact('response', 'Bill')); } $deal = Deal::where('service_id', '=', $service_id)->where('deal_type', '=', 'Service')->first(); if ($deal == null) { $deal = new Deal(); $deal->service_id = $service_id; $deal->deal_type = 'Service'; $deal->title = $service->name; $deal->amount = $service->price; $deal->discount = 0; $deal->special_request = ""; $deal->status = "active"; $deal->save(); } $Bill = new DealTransaction(); $Bill->deal_id = $deal->id; $Bill->consumer_id = Auth::user()->id; $Bill->consumer_email = Auth::user()->email; $Bill->qty = 1; $Bill->amount = $service->price; $Bill->total = $service->price; $Bill->save(); return View::make('site/user/book', compact('response', 'Bill')); } return Redirect::to('/'); }