working with laravel 5.7 and need display student table data in the home page, home.blade.php
<table class="table">
<thered>
<tr>
<td>Id</td>
<td>Name</td>
<td>Address</td>
<td>Telephone</td>
<td>Actions</td>
</tr>
</thead>
<tbody>
@foreach ($students as $student)
<tr>
<td>{{$student->id}}</td>
<td>{{$student->name}}</td>
<td>{{$student->address}}</td>
<td>{{$student->telephone}}</td>
<td><a class="button is-outlined" href="">Edit</a></td>
<td><a class="button is-outlined" href="">Delete</a></td>
</tr>
@endforeach
</tbody>
</table>
StudentController.php
public function index()
{
$students = Student::all();
return view('home');
}
web.php
Route::get('StudentController@index');
but got this error msg like this,
Undefined variable: students (View: D:\exam\curd\resources\views\home.blade.php)
How can I fix this problem?