/** * Remove the specified outlet from storage. * * @param int $id * @return Response */ public function destroy($id) { $outlets = Outlet::where('retailer_id', $id)->get(); Outlet::destroy($outlets); Retailer::destroy($id); return Redirect::route('admin.retailers.index'); }
public function deleteUser($id) { $user = User::find($id); if ($user->hasRole('AdminOutlet')) { $outlet = Outlet::where('user_id', $id)->first(); $outlet->delete(); } User::destroy($id); return Redirect::to('admin/users')->with('message', 'berhasil menghapus user'); }
public function pelangganOutlet() { $term = Input::get('term'); $outlet = Outlet::where('user_id', Auth::user()->id)->first(); $data = OutletPelanggan::distinct()->select('nama', 'id', 'telp')->where('outlet_laundry_id', $outlet->id)->where('nama', 'LIKE', '%' . $term . '%')->groupBy('id')->take(15)->get(); $result = []; foreach ($data as $d) { if (strpos(Str::lower($d), $term) !== false) { $result[] = ['value' => $d->nama, 'id' => $d->id, 'telp' => $d->telp]; } } return Response::json($result); }
/** * Show the form for editing the specified resource. * GET /outlets/{id}/edit * * @param int $id * @return Response */ public function edit($id) { $outlet = Outlet::where('user_id', Auth::user()->id)->first(); $pemasukan = OutletPemasukan::findOrFail($id); $status = ['1' => 'Masuk', '2' => 'Proses', '3' => 'Selesai', '4' => 'Diambil']; return View::make('admin.outlets.edit', compact('outlet', 'pemasukan', 'status')); }
public function getSpaLocations($retailer_id) { Activity::log(['contentId' => $retailer_id, 'contentType' => 'Outlet Location', 'action' => 'GetSpaLocations', 'description' => 'Get Locations of Outlets for an Retailer', 'details' => 'Outlet Id: ' . $retailer_id, 'updated' => false]); return Outlet::where('retailer_id', '=', $retailer_id)->get(); }
public function getIndex() { return View::make('outlets.index')->with('outlets', Outlet::where('user_id', '=', Auth::user()->id)->get()); }