app/Http/Controllers/HomeController.php
/**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
Show the application dashboard.
@return \Illuminate\Contracts\Support\Renderable
Show the application dashboard . @return \ Illuminate \ Contracts \ Support \ Renderable
public function index()
    {
        $today = date('Y-m-d');
        $orders = DashboardOrder::all();
        $task = Task::where('status', 1)->count();
        $lead = Lead::where('status', 1)->count();
        $deal = Deal::where('status', 1)->count();
        $open_task = $task ?? 0 + $lead ?? 0 + $deal ?? 0;
        $today_task = Task::where('status', 1)->whereDate('created_at', '=', $today )->count();
        $today_lead = Lead::where('status', 1)->whereDate('created_at', '=', $today )->count();
        $today_deal = Deal::where('status', 1)->whereDate('created_at', '=', $today )->count();
        $today_count = $today_task ?? 0 + $today_lead ?? 0 + $today_deal ?? 0;
        $closed_task = Task::where('status', 2)->count();
        $closed_lead = Lead::where('status', 2)->count();
        $closed_deal = Deal::where('status', 2)->count();
        $closed_count = ($closed_task ?? 0) + ($closed_lead ?? 0) + ($closed_deal ?? 0);
        $planned_task = Task::count();
        $planned_lead = Lead::count();
        $planned_deal = Deal::count();
        $planned_count = ( $planned_task ?? 0 ) + ( $planned_lead ?? 0 ) + ( $planned_deal ?? 0 );
        $my_task = $this->my_task();
        $close_week = $this->close_week();
        $planned_done = $this->get_done_planed();
        $conversion = $this->get_deal_conversion();
        $overall_collection = $this->overall_collection();
        $params['open_task']        =   $open_task;
        $params['today_count']      =   $today_count;
        $params['planned_count']    =   $planned_count;
        $params['closed_count']     =   $closed_count;
        $params['my_task']          =   $my_task;
        $params['close_week']       =   $close_week;
        $params['planned_done']     =   $planned_done;
        $params['conversion']       =   $conversion;
        $params['overall_collection'] = $overall_collection;
        $user_dashboard     =   User::find(auth()->user()->id);
        $starting_order     =   [["sortable-1","sortable-2","sortable-3","sortable-4","sortable-5","sortable-6","sortable-7","sortable-8","sortable-9"],["col-6","col-6","col-6","col-6","col-6","col-6","col-6","col-6","col-6"]];
        $sortable           =   json_decode($user_dashboard->sorting_order) ?? $starting_order;
        return view('dashboard.home', $params , compact('sortable'));
    }
public function index ( ) { $ today = date ( 'Y-m-d' ) ; $ orders = DashboardOrder :: all ( ) ; $ task = Task :: where ( 'status' , 1 ) -> count ( ) ; $ lead = Lead :: where ( 'status' , 1 ) -> count ( ) ; $ deal = Deal :: where ( 'status' , 1 ) -> count ( ) ; $ open_task = $ task ?? 0 + $ lead ?? 0 + $ deal ?? 0 ; $ today_task = Task :: where ( 'status' , 1 ) -> whereDate ( 'created_at' , '=' , $ today ) -> count ( ) ; $ today_lead = Lead :: where ( 'status' , 1 ) -> whereDate ( 'created_at' , '=' , $ today ) -> count ( ) ; $ today_deal = Deal :: where ( 'status' , 1 ) -> whereDate ( 'created_at' , '=' , $ today ) -> count ( ) ; $ today_count = $ today_task ?? 0 + $ today_lead ?? 0 + $ today_deal ?? 0 ; $ closed_task = Task :: where ( 'status' , 2 ) -> count ( ) ; $ closed_lead = Lead :: where ( 'status' , 2 ) -> count ( ) ; $ closed_deal = Deal :: where ( 'status' , 2 ) -> count ( ) ; $ closed_count = ( $ closed_task ?? 0 ) + ( $ closed_lead ?? 0 ) + ( $ closed_deal ?? 0 ) ; $ planned_task = Task :: count ( ) ; $ planned_lead = Lead :: count ( ) ; $ planned_deal = Deal :: count ( ) ; $ planned_count = ( $ planned_task ?? 0 ) + ( $ planned_lead ?? 0 ) + ( $ planned_deal ?? 0 ) ; $ my_task = $ this -> my_task ( ) ; $ close_week = $ this -> close_week ( ) ; $ planned_done = $ this -> get_done_planed ( ) ; $ conversion = $ this -> get_deal_conversion ( ) ; $ overall_collection = $ this -> overall_collection ( ) ; $ params [ 'open_task' ] = $ open_task ; $ params [ 'today_count' ] = $ today_count ; $ params [ 'planned_count' ] = $ planned_count ; $ params [ 'closed_count' ] = $ closed_count ; $ params [ 'my_task' ] = $ my_task ; $ params [ 'close_week' ] = $ close_week ; $ params [ 'planned_done' ] = $ planned_done ; $ params [ 'conversion' ] = $ conversion ; $ params [ 'overall_collection' ] = $ overall_collection ; $ user_dashboard = User :: find ( auth ( ) -> user ( ) -> id ) ; $ starting_order = [ [ " sortable-1 " , " sortable-2 " , " sortable-3 " , " sortable-4 " , " sortable-5 " , " sortable-6 " , " sortable-7 " , " sortable-8 " , " sortable-9 " ] , [ " col-6 " , " col-6 " , " col-6 " , " col-6 " , " col-6 " , " col-6 " , " col-6 " , " col-6 " , " col-6 " ] ] ; $ sortable = json_decode ( $ user_dashboard -> sorting_order ) ?? $ starting_order ; return view ( 'dashboard.home' , $ params , compact ( 'sortable' ) ) ; }
Show the application dashboard.
Show the application dashboard .
// $info = CompanySettings::find(1); //get open task //get today task //get closed task //get planned task //mytask //all task // $all_task = $this->all_task(); //close of the week