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()
    {   
        $admin_id = Auth::user()->id;
        $usersCount = User::all()->count();
        $latestUsers = User::all()->take(5);
        $categoryCount = Category::all()->count();
        $latestCategory = Category::orderBy('id','desc')->take(5)->get();
        $subCategoryCount = SubCategory::all()->count();
        $latestSubCategory = SubCategory::orderBy('id','desc')->take(5)->get();
        return view('home')->with(compact('usersCount', 'latestUsers','categoryCount','latestCategory','subCategoryCount','latestSubCategory'));
    }
public function index ( ) { $ admin_id = Auth :: user ( ) -> id ; $ usersCount = User :: all ( ) -> count ( ) ; $ latestUsers = User :: all ( ) -> take ( 5 ) ; $ categoryCount = Category :: all ( ) -> count ( ) ; $ latestCategory = Category :: orderBy ( 'id' , 'desc' ) -> take ( 5 ) -> get ( ) ; $ subCategoryCount = SubCategory :: all ( ) -> count ( ) ; $ latestSubCategory = SubCategory :: orderBy ( 'id' , 'desc' ) -> take ( 5 ) -> get ( ) ; return view ( 'home' ) -> with ( compact ( 'usersCount' , 'latestUsers' , 'categoryCount' , 'latestCategory' , 'subCategoryCount' , 'latestSubCategory' ) ) ; }
Show the application dashboard.
Show the application dashboard .