我创建了一个名为category.php的模型,如下面的代码所示:
<?php
namespace App'Models;
use Illuminate'Database'Eloquent'Model;
class Category extends Models
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $table = 'categories';
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $fillable = ['name',];
protected $hidden = [];
}
现在每当我尝试运行我的网站,我得到这个错误:
FatalErrorException in category.php line 7:
Class 'App'Models'Models' not found
我不知道我哪里做错了,希望能得到帮助。
提前感谢,
凯文
您应该在Models文件夹中有一个名为"Models"的类,或者,以正确的方式扩展雄辩的模型。
<?php
namespace App'Models;
use Illuminate'Database'Eloquent'Model;
class Category extends Model
{
}