Created
April 27, 2017 19:30
-
-
Save lloy0076/0fee3b3b99abdd78deea9daf2ea8ab0f to your computer and use it in GitHub Desktop.
Laravel Seeder - Confound It!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c:\laragon\www\backpack\database\seeds (master) | |
λ cat DatabaseSeeder.php Cities.php | |
<?php | |
use Illuminate\Database\Seeder; | |
class DatabaseSeeder extends Seeder | |
{ | |
/** | |
* Run the database seeds. | |
* | |
* @return void | |
*/ | |
public function run() | |
{ | |
$this->call(Cities::class); | |
} | |
} | |
<?php | |
use Illuminate\Database\Seeder; | |
use Illuminate\Database\Eloquent\Model; | |
class Cities extends Seeder | |
{ | |
public function run() | |
{ | |
DB::table('tests')->insert([ | |
'name' => 'Adelaide', | |
'phone_no' => '1234567890', | |
'description' => 'The city of churches', | |
]); | |
DB::table('tests')->insert([ | |
'name' => 'Sydney', | |
'phone_no' => '2345678901', | |
'description' => 'The harbour city', | |
]); | |
DB::table('tests')->insert([ | |
'name' => 'New York', | |
'phone_no' => '31547899', | |
'description' => 'The big apple', | |
]); | |
} | |
} | |
c:\laragon\www\backpack (master) | |
λ php artisan db:seed | |
Seeding: Cities | |
[ReflectionException] | |
Class Cities does not exist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment