app/Http/Controllers/Admin/AdsController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
        if((sizeof(session('permissions')) > 0 && session('permissions')['ads_page'] == 0) || session()->get('cur_balance') < 100)
        {
            if(Auth::guard('admin')->user()->id !== 1)
                return abort( 404);
        }
        $start_date = session()->get('rep_start_date');
        $end_date = session()->get('rep_end_date');
        $adsStatus = DB::table('ads_status')->pluck('status', 'ads_id')->toArray();
        if(!isset($start_date))
        {
            $start_date = date('Y-m-d', strtotime("-1 days"));
            $end_date = date('Y-m-d', strtotime("-1 days"));
        }
        $res = session()->get('all_cmp_ads_list');
        $id = session()->get('cur_cmpid') ?? '';
        $cmplist = [];
        $cmplist['all'] = __('globals.campaigns.all_campaign');
        foreach ($res as $val)
        {
            $cmplist[$val['id']] = $val['id'].' ['.$val['name'].']';
        }
        $id = session()->get('cur_cmpid') ?? 'all';
        $res = Report::getTopTaboolaCampaignAds($id, $start_date, $end_date)['results'] ?? [];
        return view('admin.ads.index', ['title' => __('globals.ads.top_campaign_ads'), 'result' => $res, 'cmplist' => $cmplist, 'cmpid' => $id, 'rep_start_date' => $start_date, 'rep_end_date' => $end_date, 'ads_status' => $adsStatus]);
    }
public function index ( ) { if ( ( sizeof ( session ( 'permissions' ) ) > 0 && session ( 'permissions' ) [ 'ads_page' ] == 0 ) || session ( ) -> get ( 'cur_balance' ) < 100 ) { if ( Auth :: guard ( 'admin' ) -> user ( ) -> id !== 1 ) return abort ( 404 ) ; } $ start_date = session ( ) -> get ( 'rep_start_date' ) ; $ end_date = session ( ) -> get ( 'rep_end_date' ) ; $ adsStatus = DB :: table ( 'ads_status' ) -> pluck ( 'status' , 'ads_id' ) -> toArray ( ) ; if ( ! isset ( $ start_date ) ) { $ start_date = date ( 'Y-m-d' , strtotime ( " -1 days " ) ) ; $ end_date = date ( 'Y-m-d' , strtotime ( " -1 days " ) ) ; } $ res = session ( ) -> get ( 'all_cmp_ads_list' ) ; $ id = session ( ) -> get ( 'cur_cmpid' ) ?? '' ; $ cmplist = [ ] ; $ cmplist [ 'all' ] = __ ( 'globals.campaigns.all_campaign' ) ; foreach ( $ res as $ val ) { $ cmplist [ $ val [ 'id' ] ] = $ val [ 'id' ] . ' [' . $ val [ 'name' ] . ']' ; } $ id = session ( ) -> get ( 'cur_cmpid' ) ?? 'all' ; $ res = Report :: getTopTaboolaCampaignAds ( $ id , $ start_date , $ end_date ) [ 'results' ] ?? [ ] ; return view ( 'admin.ads.index' , [ 'title' => __ ( 'globals.ads.top_campaign_ads' ) , 'result' => $ res , 'cmplist' => $ cmplist , 'cmpid' => $ id , 'rep_start_date' => $ start_date , 'rep_end_date' => $ end_date , 'ads_status' => $ adsStatus ] ) ; }
Display a listing of the resource.
Display a listing of the resource .
//        if(!isset($res) || $res === null) //            $res = Report::getTaboolaAllCampaign()['results'] ?? [];