Connection.php中的QueryException,ErrorException和PDOException [英] QueryException, ErrorException and PDOException in Connection.php
本文介绍了Connection.php中的QueryException,ErrorException和PDOException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想问一下您是否可以帮助我解决新安装的Laravel 5.4遇到的错误.这是我的刀片模板
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
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
推荐答案
- 您正在尝试在视图中运行数据库查询,该查询更适合您的控制器.
- 您不能同时使用first()和get(),只能使用一个.
- 您正在尝试直接输出查询结果,它是一个对象,即使您的查询成功,它也会引发错误.
这篇关于Connection.php中的QueryException,ErrorException和PDOException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文