43 lines
724 B
PHP
43 lines
724 B
PHP
<?php
|
|
|
|
use Phinx\Seed\AbstractSeed;
|
|
|
|
class RolesSeeder extends AbstractSeed
|
|
{
|
|
public function run(): void
|
|
{
|
|
$data = [
|
|
[
|
|
'id' => 1,
|
|
'description' => 'guest',
|
|
'level' => 0,
|
|
'inherits' => 0,
|
|
],
|
|
[
|
|
'id' => 2,
|
|
'description' => 'administrador',
|
|
'level' => 99,
|
|
'inherits' => 3,
|
|
],
|
|
[
|
|
'id' => 3,
|
|
'description' => 'operador',
|
|
'level' => 50,
|
|
'inherits' => 4,
|
|
],
|
|
[
|
|
'id' => 4,
|
|
'description' => 'usuario',
|
|
'level' => 1,
|
|
'inherits' => 1,
|
|
],
|
|
];
|
|
|
|
$this->execute('SET unique_checks=0; SET foreign_key_checks=0;');
|
|
$this->table('roles')
|
|
->insert($data)
|
|
->saveData();
|
|
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
|
}
|
|
}
|