I am new to Laravel and am having trouble loading my models to seed a database. I tried both the Laravel 4 method for the .json composer and the Laravel 5 PSR-4.
DatabaseSeeder.php
use Illuminate\Database\Seeder; use Illuminate\Database\Eloquent\Model; class DatabaseSeeder extends Seeder { public function run() { \App\Models\Client::truncate(); \App\Models\Module::truncate(); \App\Models\ModuleConnection::truncate(); Model::unguard(); $this->call('ClientsTableSeeder'); $this->call('ModulesTableSeeder'); $this->call('ConncetionsTableSeeder'); } }
Client.php
This is in the application \ Models at the moment, but I tried them in the application next to Users.php
namespace App\Models; use Illuminate\Database\Eloquent\Model as Eloquent; class Client extends \Eloquent { proteced $fillable = ['id', 'name', 'email', 'created_at', 'updated_at']; }
module.php
namespace App\Models; use Illuminate\Database\Eloquent\Model as Eloquent; class Module extends \Eloquent { proteced $fillable = ['id', 'name', 'created_at', 'updated_at']; }
ModuleConnection.php
namespace App\Models; use Illuminate\Database\Eloquent\Model as Eloquent; class ModuleConnection extends \Eloquent { proteced $fillable = ['id', 'clientid', 'moduleid', 'apiconn', 'created_at', 'updated_at']; }
Error
This is when I run php artisan db: seed
[Symfony\Component\Debug\Exception\FatalErrorException] Class 'App\Models\Client' not found
I'm sure this is something stupid, I disappeared as a newbie! Thanks!
source share