Friday, March 10, 2017

Laravel: Retrieve data from DB and diplay in View

I have a bug here in my code that show me a probleme while displaying data in the home page

Controller

class Annonce_indexController extends Controller
{
    public function index()
    {
        $annonce_residentiel = Annonce_residentiel::all();   
        return view('/' , compact('annonce_residentiel'));
    }
}

Route

  Route::get('/index','Annonce_indexController@index');

Blade View



It says that $annonce_residentiel is undefined



via Marouane Sihad

Advertisement