Я новичок в laravel. У меня есть таблица, но у меня нет модели для этого. Я использую ниже для извлечения записи.
$classes = DB::table('school_classes')->get();
return view('classes', ['allClass' => $classes]);
он возвращает ниже:
[{"id":1,"register_school_id":1,"class":"I","section":"A","created_at":"2020-03-19 00:00:00","updated_at":"2020-03-19 00:00:00"},
{"id":2,"register_school_id":1,"class":"I","section":"B","created_at":"2020-03-19 00:00:00","updated_at":"2020-03-19 00:00:00"},
{"id":3,"register_school_id":1,"class":"I","section":"C","created_at":"2020-03-19 00:00:00","updated_at":"2020-03-19 00:00:00"}, {"id":4,"register_school_id":1,"class":"I","section":"D","created_at":"2020-03-19 00:00:00","updated_at":"2020-03-19 00:00:00"},
{"id":5,"register_school_id":1,"class":"I","section":"E","created_at":"2020-03-19 00:00:00","updated_at":"2020-03-19 00:00:00"}]
как я могу выбрать значение отдельно для каждого элемента ... я пробовал foreach, но получаю ошибку. Пожалуйста, помогите. заранее спасибо.