Reputation: 4296
I created a model called category.php as you can see in the code provided below:
<?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 = [];
}
Now whenever i try to run my site i get this error:
FatalErrorException in category.php line 7:
Class 'App\Models\Models' not found
I dont know what i did wrong here all help would be appreciated.
Thanks in advance,
-Kevin
Upvotes: 0
Views: 52
Reputation: 2601
You should have a class called "Models" inside your models folder, or, extend the eloquent model the right way.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Category extends Model
{
}
Upvotes: 1