app/Http/Controllers/SearchController.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(Request $request)
    {
        if($request['buyorsell']=="buy")
        {   
            $ad=Ad::where('is_approve',1)
          ->with('cities')
          ->with('states')->get();
           $city=City::All();
            $state=state::All();
            return view('pages.buyandsell')->with('ad',$ad)->with('city',$city)->with('state',$state);
            }
            $city=City::All();
            $state=state::All();
            return view('registration')->with('city',$city)->with('state',$state);
    }
public function index ( Request $ request ) { if ( $ request [ 'buyorsell' ] == " buy " ) { $ ad = Ad :: where ( 'is_approve' , 1 ) -> with ( 'cities' ) -> with ( 'states' ) -> get ( ) ; $ city = City :: All ( ) ; $ state = state :: All ( ) ; return view ( 'pages.buyandsell' ) -> with ( 'ad' , $ ad ) -> with ( 'city' , $ city ) -> with ( 'state' , $ state ) ; } $ city = City :: All ( ) ; $ state = state :: All ( ) ; return view ( 'registration' ) -> with ( 'city' , $ city ) -> with ( 'state' , $ state ) ; }
Display a listing of the resource.
Display a listing of the resource .