Conditions | 5 |
Paths | 9 |
Total Lines | 46 |
Code Lines | 31 |
Lines | 0 |
Ratio | 0 % |
Tests | 28 |
CRAP Score | 5.1374 |
Changes | 0 |
1 | <?php |
||
10 | 9 | public function run() |
|
11 | { |
||
12 | // But seriously no |
||
13 | 9 | if(App::environment() == 'production') { |
|
14 | echo 'No, seriously'; |
||
15 | |||
16 | return; |
||
17 | } |
||
18 | 9 | $disableForeignKeyChecks = in_array(DB::connection()->getDriverName(), ['mysql']); |
|
19 | |||
20 | 9 | Eloquent::unguard(); |
|
21 | 9 | if ($disableForeignKeyChecks) { |
|
22 | DB::statement('SET FOREIGN_KEY_CHECKS=0;'); |
||
23 | } |
||
24 | |||
25 | // Cleanup |
||
26 | $tables = [ |
||
27 | 9 | 'league_admins', |
|
28 | 9 | 'league_team_movies', |
|
29 | 9 | 'league_movies', |
|
30 | 9 | 'league_team_user', |
|
31 | 9 | 'league_teams', |
|
32 | 9 | 'leagues', |
|
33 | 9 | 'movie_earnings', |
|
34 | 9 | 'movies', |
|
35 | 'users' |
||
36 | 9 | ]; |
|
37 | 9 | foreach($tables as $table) { |
|
38 | 9 | DB::table($table)->truncate(); |
|
39 | 9 | } |
|
40 | |||
41 | 9 | if ($disableForeignKeyChecks) { |
|
42 | DB::statement('SET FOREIGN_KEY_CHECKS=1;'); |
||
43 | } |
||
44 | |||
45 | // Seeding |
||
46 | 9 | $this->call('UserTableSeeder'); |
|
47 | 9 | $this->call('LeagueTableSeeder'); |
|
48 | 9 | $this->call('LeagueAdminsTableSeeder'); |
|
49 | 9 | $this->call('MovieTableSeeder'); |
|
50 | 9 | $this->call('MovieEarningsTableSeeder'); |
|
51 | 9 | $this->call('LeagueMoviesTableSeeder'); |
|
52 | 9 | $this->call('LeagueTeamsTableSeeder'); |
|
53 | 9 | $this->call('LeagueTeamUsersTableSeeder'); |
|
54 | 9 | $this->call('LeagueTeamMoviesTableSeeder'); |
|
55 | 9 | } |
|
56 | |||
58 |
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.