samedi 3 octobre 2015

Error while fetching data from database in laravel 5.1

Good day

I am facing a problem while fetching the data from database

view.php

<p>attend</p>
@foreach($attendings as $attending)
@if  ($attending->acceptance==1)
{{ $attending->membername }}
@endif
@endforeach
&nbsp;&nbsp;&nbsp;&nbsp;
<p>not attend</p>
@foreach($attendings as $attending)
@if  ($attending->acceptance==0)
{{ $attending->membername }}
@endif
@endforeach
<br>
<br>
<p>final decision </p>
{{ $attendings->editor_com }}

controller

public function attendx()
{
       $attendings = DB::table('attendance')->get();
       return view('My_Work.report', ['attendings' => $attendings]);

}

routes

get('/editor/report','DatabaseController@attendx');

but what I'm facing is Undefined variable: attendings

how I can fix the error

Note: I am writing the codes in laravel 5.1

Thank you

Best regards



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire