public function ReportsDate(Request $request) { if ($request->ajax()) { $date = date('Y-m-d', strtotime($request->input('date'))); $todate = date('Y-m-d', strtotime($request->input('todate'))); $idad = $request->input('ad'); $idweb = $request->input('web'); if ($idad == 0) { if ($idweb == 'all') { if ($request->ajax()) { $reports = Report::TimeReport($date, $todate); return response()->json(["web" => $reports]); } } else { if ($request->ajax()) { if ($idad == 'all') { if ($request->ajax()) { $reports = Report::TimeReport($date, $todate); return response()->json(["web" => $reports]); } } else { $ad = Web::find($idweb); $reports = Report::ReportTime($date, $todate, $ad->id); return response()->json(["web" => $reports]); } } } } else { if ($idad == 'all' || $idweb == 'all') { if ($request->ajax()) { $reports = Report::TimeReport($date, $todate); return response()->json(["web" => $reports]); } } else { if ($request->ajax()) { $ad = Ad::find($idad); $web = Web::find($idweb); $reports = Report::TimeReportComplete($date, $todate, $ad->id, $web->id); return response()->json(["web" => $reports]); } } } } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $web = Web::find($id); $delete = $web->delete(); if ($delete) { notify()->flash('Web delte correctly', 'success', ['timer' => 3000, 'text' => '']); } else { notify()->flash('There was a problem creating the advert', 'error', ['timer' => 3000, 'text' => '']); } return redirect()->to('admin/web'); }