database/seeds/DatabaseSeeder.php
/**
     * Seed the application's database.
     *
     * @return void
     */
Seed the application's database.
@return void
Seed the application ' s database . @return void
public function run()
    {
        $execute = true;
        if (User::count() > 0) {
            $this->command->warn('Confirma executar as seeds do sistema? Os registros atuais do banco de dados serão apagados.');
            $question = $this->command->ask('Responda com "S" para sim ou outra tecla qualquer para cancelar');
            if ($question != 'S' && $question != 's') {
                $execute = false;
            } else {
                $this->TruncTables();
            }
        }
        if ($execute) {
            $this->call(SettingTableSeeder::class);
            $this->call(UsersTableSeeder::class);
            $this->call(PermissionsTableSeeder::class);
            $this->call(RolesTableSeeder::class);
            $this->call(PermissionRoleTableSeeder::class);
            $this->call(RoleUserTableSeeder::class);
        } else {
            $this->command->line('Operação cancelada.');
            exit(0);
        }
    }
public function run ( ) { $ execute = true ; if ( User :: count ( ) > 0 ) { $ this -> command -> warn ( 'Confirma executar as seeds do sistema? Os registros atuais do banco de dados serão apagados.') ; $ question = $ this -> command -> ask ( 'Responda com "S" para sim ou outra tecla qualquer para cancelar' ) ; if ( $ question != 'S' && $ question != 's' ) { $ execute = false ; } else { $ this -> TruncTables ( ) ; } } if ( $ execute ) { $ this -> call ( SettingTableSeeder :: class ) ; $ this -> call ( UsersTableSeeder :: class ) ; $ this -> call ( PermissionsTableSeeder :: class ) ; $ this -> call ( RolesTableSeeder :: class ) ; $ this -> call ( PermissionRoleTableSeeder :: class ) ; $ this -> call ( RoleUserTableSeeder :: class ) ; } else { $ this -> command -> line ( 'Operação cancelada.'); exit ( 0 ) ; } }
Seed the application's database.
Seed the application ' s database .