I would like to ask if you can help me with the errors I am encountering with my newly installed Laravel 5.4. Here is my blade template
home.blade.php
@extends('layouts.app') @section('content') <div class="container">
<div class="row">
{{ App\StudentHistory::select(['date', 'student_id', 'grade'])
->where('subject', 'English')
->groupBy('student_id')
->orderBy('date','desc')
->first()
->get()}}
</div>@endsection
Let me know what else you guys need, I'll update as you ask
You're doing xxx->first()->get() ...
You either call ->first() and get one object or do ->get() and get an array of objects
Reference https://laravel.com/docs/5.4/queries#retrieving-results
PS: I really can't see the advantages of doing those queries IN the view, that's missing the MVC objective of laravel.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.