Support the ongoing development of Laravel.io →
posted 11 years ago
Database

###Here is my seeder table class

class DataClassificationTableSeeder extends Seeder{

	//Data Classification

	public function run(){
		DB::table('data_classifications')->delete();

		$Datas = array(
			'',
			'Top Secret',
			'Secret',
			'Confidential',
			'Restricted',
			'Unclassified'
			);
		DataClassification::unguard();
		foreach($Datas as $key => $Data){
			if($key == ''){
				continue;
			 }
			else{
				DataClassification::create(array(
					'id'	=> $key,
					'classification'	=> $Data,
					));
			}
		}
		DataClassification::reguard();
	}

}

and i added following line in databaseseeder class

$this->call('DataClassificationTableSeeder');

Here is modal for this

class DataClassification extends Eloquent {

	//Data Classification

	protected $table = 'data_classifications';

	protected $primaryKey = 'id';

	public $timestamps = false;

}

all my tables get seeds but this is not seeding and also not giving any error I have to manually call this from terminal to seed then it works fine

Last updated 3 years ago.
0

check the table seeder that is called before this one

Last updated 3 years ago.
0

These are before and after all are working without any error

$this->call('SystemOwnerTableSeeder');
		$this->call('SystemStewardTableSeeder');
		$this->call('DataClassificationTableSeeder');
		$this->call('AccessibilityTableSeeder');
		$this->call('DataLocationTableSeeder');
Last updated 3 years ago.
0

Oops I found one of my seeder table was deleting its content f.... copy past.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

moonbasra moonbasra Joined 4 Mar 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.

© 2025 Laravel.io - All rights reserved.