-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ceedbc
commit 82a7166
Showing
5 changed files
with
16 additions
and
53 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,20 @@ | ||
<?php | ||
|
||
use App\Cid10; | ||
use Illuminate\Database\Seeder; | ||
use Illuminate\Support\Facades\DB; | ||
|
||
class cid10TableSeeder extends Seeder | ||
{ | ||
/** | ||
* Run the database seeds. | ||
* | ||
* @return void | ||
*/ | ||
public function run() | ||
{ | ||
$cids = json_decode(file_get_contents(__DIR__ . '/cid10.json')); | ||
$cids = (array) json_decode(file_get_contents(__DIR__ . '/cid10.json')); | ||
|
||
$inserts = []; | ||
|
||
if (env('APP_ENV') === 'test'){ | ||
DB::table('cid10')->insert([ | ||
'nome' =>$cids[0]->nome, | ||
'codigo' => $cids[0]->codigo | ||
]); | ||
}else{ | ||
foreach ($cids as $cid){ | ||
DB::table('cid10')->insert([ | ||
'nome' =>$cid->nome, | ||
'codigo' => $cid->codigo | ||
]); | ||
} | ||
foreach ($cids as $cid){ | ||
array_push($inserts, (array) $cid); | ||
} | ||
|
||
Cid10::insert($inserts); | ||
} | ||
} |