public function ReportsAjaxAd(Request $request, $id, $idweb) { if ($idweb == 0) { if ($id == 'all') { if ($request->ajax()) { $ads = Report::webs(); $reports = Report::ReportHomeClient(); return response()->json(["web" => $reports, 'ads' => $ads]); } } else { if ($request->ajax()) { $ad = Ad_Web::find($id); $ads = Report::WebAjaxReport($id); $reports = Report::ReportAdClient($ad->id); return response()->json(["web" => $reports, "ads" => $ads]); } } } else { if ($id == 'all') { if ($request->ajax()) { $ads = DB::table('webs')->join('users', 'users.id', '=', 'webs.user_id')->where('users.id', '=', Auth::user()->id)->select('webs.*')->get(); $reports = Report::ReportHomeClient(); return response()->json(["web" => $reports, 'ads' => $ads]); } } else { if ($request->ajax()) { $ad_web = Ad_Web::find($id); $web = Web::find($idweb); $ads = Report::WebAjaxReport($ad_web->id); $reports = Report::ReportAdWebClient($ad_web->id, $idweb); return response()->json(["web" => $reports, "ads" => $ads]); } } } }