я просто пытаюсь создать базу данных для студентов, но когда я запрашиваю страницу просмотра записей, она не работает и выдает ошибку, почему она не работает, я просто хочу просмотреть свои записи из своей базы данных
Контроллер
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class StudViewController extends Controller {
public function index(){
/*$users = DB::select('select * from tudent');*/
$users = DB::table('student')->select(DB::raw('*'))->get();
return view('stud_view',['users'=>$users]);
}
}
это вид
<html>
<head>
<title>View Student Records</title>
</head>
<body>
<table border = 1>
<tr>
<td>ID</td>
<td>Name</td>
</tr>
@foreach ($users as $user)
<tr>
<td>{{ $user->id }}</td>
<td>{{ $user->name }}</td>
</tr>
@endforeach
</table>
</body>
</html>
это маршрут
Route::get('/', function () {
return view('welcome');
});
// ----------- insert student --------------
Route::get('insert','StudInsertController@insertform');
Route::post('create','StudInsertController@insert');
// ----------- view Record --------------
Route::get('view-records','StudViewController@index');