/** * Display a listing of the resource. * * @return Response */ public function index() { $sales = Sale::orderBy('id', 'desc')->first(); $customers = Customer::lists('name', 'id'); // print_r($sales); return view('sale.index')->with('sale', $sales)->with('customer', $customers); }
/** * Show the application dashboard to the user. * * @return Response */ public function index() { $items = Item::where('type', 1)->count(); $item_kits = Item::where('type', 2)->count(); $customers = Customer::count(); $suppliers = Supplier::count(); $receivings = Receiving::count(); $sales = Sale::count(); $employees = User::count(); // passing jam variable $array_hari = array(1 => "Senin", "Selasa", "Rabu", "Kamis", "Jum'at", "Sabtu", "Minggu"); $hari = $array_hari[date("N")]; $tanggal = date("j"); $array_bulan = array(1 => "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"); $bulan = $array_bulan[date("n")]; $tahun = date("Y"); $date = "{$tanggal} {$bulan} {$tahun}"; $time = date("H:i:s"); //end jam return view('home')->with('items', $items)->with('item_kits', $item_kits)->with('customers', $customers)->with('suppliers', $suppliers)->with('receivings', $receivings)->with('sales', $sales)->with('employees', $employees)->with('date', $date); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { try { $customers = Customer::find($id); $customers->delete(); // redirect Session::flash('message', 'You have successfully deleted customer'); return Redirect::to('customers'); } catch (\Illuminate\Database\QueryException $e) { Session::flash('message', 'Integrity constraint violation: You Cannot delete a parent row'); Session::flash('alert-class', 'alert-danger'); return Redirect::to('customers'); } }