我有一个非常基本的问题。在 L4 中,以下方法是开箱即用的,所以现在我迷路了。请帮忙。几天前我开始了一个 Laravel 5.0 项目。我现在有全新、干净的安装。
问题 1:当我尝试从数据库中获取任何内容时
$headquote = DB::table('quotation_texts')->find(176);
我明白了:
Class 'App\Http\Controllers\DB' not found
问题 2:在我克隆 User.php 模型之前,将类名更改为“引用”。以下是放在 App 根文件夹中的 Quotations.php 文件的内容:
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Quotation extends Model {
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'quotation_texts';
}
任何使用模型的尝试
$headquote = Quotation::find(176);
以这个结束:
Class 'App\Http\Controllers\Quotation' not found
有什么想法可以解决这个问题吗?