jeudi 4 août 2016

Error while fetching data from database laravel 5.1

I am new to laravel. I am facing error while i fetch the data from database. But other pages are working (fetching also).

Here is My code for your review. my contorller :

 public function info()
{

    // Show the page
    $data = Customer::all();
    return view('eventlist')->with('data',$data);

}    

My view :eventlist.blade.php

             <tbody>
                @foreach ($events as $user)
                    <tr>
                        <td>{!! $user->name !!}</td>
                        <td>{!! $user->cname !!}</td>
                        <td>{!! $user->sdate !!}</td>
                        <td>{!! $user->edate !!}</td>
                        <td>{!! $user->room !!}</td> </tr>@endforeach                        
                </tbody>

My route :

Route::get('eventlist', 'MyController@info');`

While i try to fetch the data : It shows the error undefined variable :events

Help me to solve this issue. Thanks in advance



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire