for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
class DatabaseSeeder extends Seeder {
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// But seriously no
if(App::environment() == 'production') {
echo 'No, seriously';
return;
}
$disableForeignKeyChecks = in_array(DB::connection()->getDriverName(), ['mysql']);
Eloquent::unguard();
if ($disableForeignKeyChecks) {
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
// Cleanup
$tables = [
'league_admins',
'league_team_movies',
'league_movies',
'league_team_user',
'league_teams',
'leagues',
'movie_earnings',
'movies',
'users'
];
foreach($tables as $table) {
DB::table($table)->truncate();
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
// Seeding
$this->call('UserTableSeeder');
$this->call('LeagueTableSeeder');
$this->call('LeagueAdminsTableSeeder');
$this->call('MovieTableSeeder');
$this->call('MovieEarningsTableSeeder');
$this->call('LeagueMoviesTableSeeder');
$this->call('LeagueTeamsTableSeeder');
$this->call('LeagueTeamUsersTableSeeder');
$this->call('LeagueTeamMoviesTableSeeder');
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.