Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 1 year ago.
0

For your Eloquent not found see https://github.com/laravel/laravel/pull/2985/files

Last updated 1 year ago.
0

logaso said:

second : can't found class LinkSeeder, even if exists .

This problem still exists. I'm trying to seed Users table with UserTableSeeder.php but Artisan tells me that the class UserTableSeeder does not exist. Couldn't find a solution yet so I can't use DB Seeding.

UPDATE: I found a solution. First you have to run the optimize command to use DB seeding;

$ php artisan optimize

You also have to USE namespaced files like below;

// database/seeds/UserTableSeeder.php
<?php

use Illuminate\Database\Seeder;
use App\User;

class UserTableSeeder extends Seeder {

	public function run()
	{
		DB::table('users')->truncate();

		User::create(array('email' => '[email protected]'));
	}

}
Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

logaso logaso Joined 12 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.