public function exportLaporan(Request $request) { $input = $request->all(); $orders = \DB::table('order')->get(); $headers = ['Nama', 'Alamat', 'Telepon', 'Pewangi', 'Pengerjaan', 'Berat', 'Total bayar', 'Status', 'Lunas']; $tanggal = Date::today(); if (Input::get('pdf')) { $pdf = \PDF::loadView('print.layout', compact('headers', 'orders', 'tanggal'))->setPaper('a4')->setOrientation('landscape'); return $pdf->stream(); } elseif (Input::get('excel')) { $data = compact('headers', 'orders', 'tanggal'); $title = 'Order_' . $data['tanggal']; return Excel::create($title, function ($excel) use($data) { $excel->setTitle('Laporan Order Go-Laundry'); $excel->setCreator('Admin')->setCompany('Go-Laundry'); $excel->sheet('Laporan Order', function ($sheet) use($data) { $sheet->loadView('print.table', $data); $sheet->setAutoSize(true); }); })->export('xlsx'); } }
/** * Get game info from last match for display in first page * @return \Illuminate\Database\Eloquent\Model|null|static */ public function LastMatch() { $match = FootballMatches::whereIn('status', ['FT', 'AET'])->whereDate('formatted_date', '<=', Date::today()->format('Y-m-d'))->orderBy('formatted_date', 'desc')->first(); return $match; }