أحاول تمرير النموذج إلى view.blade عندما لا يكون النموذج فارغًا ، يتم تشغيل ملف الشفرة بدون أخطاء ولكن إذا كان النموذج فارغًا ، فإن أخطاء تشغيل ملف blade هذا هو رمزي
//StudentController code
public function viewstudent($id)
{
$student = Student::find($id);
$outputs = array($student);
return view('student',['students'=>$outputs]);
}
//student.blade.php code
<table id="myTable">
@foreach ($students as $student)
<tr>
<td>{{$student->studentname}}</td>
<td>{{$student->studentlevel}}</td>
<td>{{$student->studentgender === 1 ?'Male':'Female'}}</td>
<td>{{$student->studentbirthdate}}</td>
<td>{{$student->studentnotes}}</td>
<td>{{$student->created_at}}</td>
<td>{{$student->updated_at}}</td>
</tr>
@endforeach
</table>