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()
    {  
         $state = State::All()->first();
        $scrap = Typeofscrap::All();
        $users = DB::table('users')->where('user_type',1)->take(6)->get();
         $trader = DB::table('users')->where('user_type',2)->take(6)->get();
          $scrap = DB::table('users')->where('user_type',3)->take(6)->get();
          $ad=Ad::where('is_approve',1)
          ->with('cities')
          ->with('states')->take(6)->get();
          $city =City::All();
        return view('home')->with('state',$state)->with('scrap',$scrap)->with('users',$users)->with('trader',$trader)->with('scrap',$scrap)->with('city',$city)->with('ad',$ad);
    }
public function index ( ) { $ state = State :: All ( ) -> first ( ) ; $ scrap = Typeofscrap :: All ( ) ; $ users = DB :: table ( 'users' ) -> where ( 'user_type' , 1 ) -> take ( 6 ) -> get ( ) ; $ trader = DB :: table ( 'users' ) -> where ( 'user_type' , 2 ) -> take ( 6 ) -> get ( ) ; $ scrap = DB :: table ( 'users' ) -> where ( 'user_type' , 3 ) -> take ( 6 ) -> get ( ) ; $ ad = Ad :: where ( 'is_approve' , 1 ) -> with ( 'cities' ) -> with ( 'states' ) -> take ( 6 ) -> get ( ) ; $ city = City :: All ( ) ; return view ( 'home' ) -> with ( 'state' , $ state ) -> with ( 'scrap' , $ scrap ) -> with ( 'users' , $ users ) -> with ( 'trader' , $ trader ) -> with ( 'scrap' , $ scrap ) -> with ( 'city' , $ city ) -> with ( 'ad' , $ ad ) ; }
Show the application dashboard.
Show the application dashboard .