app/Http/Controllers/AnnoncesController.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()
    {
        $annonces = Annonce::orderBy('created_at', 'desc')->where('statut_ann', 1)->get()->load('user');
        $categ = CategAnnonce::get();
        $pubs = AcheterPack::where([['date_achat', '<=', now()],['date_fin', '>=', now()]])->get();
        $pubs = json_encode($pubs);
        return view("annonces.index", compact('annonces', 'categ', 'pubs'));
    }
public function index ( ) { $ annonces = Annonce :: orderBy ( 'created_at' , 'desc' ) -> where ( 'statut_ann' , 1 ) -> get ( ) -> load ( 'user' ) ; $ categ = CategAnnonce :: get ( ) ; $ pubs = AcheterPack :: where ( [ [ 'date_achat' , '<=' , now ( ) ] , [ 'date_fin' , '>=' , now ( ) ] ] ) -> get ( ) ; $ pubs = json_encode ( $ pubs ) ; return view ( " annonces.index " , compact ( 'annonces' , 'categ' , 'pubs' ) ) ; }
Display a listing of the resource.
Display a listing of the resource .