Revisiones
This commit is contained in:
@ -6,6 +6,13 @@ use Phinx\Seed\AbstractSeed;
|
||||
|
||||
class Comuna extends AbstractSeed
|
||||
{
|
||||
public function getDependencies(): array
|
||||
{
|
||||
return [
|
||||
'Provincia',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Run Method.
|
||||
*
|
||||
@ -29,6 +36,9 @@ class Comuna extends AbstractSeed
|
||||
if (str_contains($column, 'id')) {
|
||||
return 'id';
|
||||
}
|
||||
if (str_contains($column, 'provincia')) {
|
||||
return 'provincia';
|
||||
}
|
||||
return $column;
|
||||
}, $columns);
|
||||
$data = array_map(function ($row) use ($columns) {
|
||||
|
@ -6,6 +6,13 @@ use Phinx\Seed\AbstractSeed;
|
||||
|
||||
class Provincia extends AbstractSeed
|
||||
{
|
||||
public function getDependencies(): array
|
||||
{
|
||||
return [
|
||||
'Region',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Run Method.
|
||||
*
|
||||
@ -29,6 +36,9 @@ class Provincia extends AbstractSeed
|
||||
if (str_contains($column, 'id')) {
|
||||
return 'id';
|
||||
}
|
||||
if (str_contains($column, 'region')) {
|
||||
return 'region';
|
||||
}
|
||||
return $column;
|
||||
}, $columns);
|
||||
$data = array_map(function ($row) use ($columns) {
|
||||
|
@ -29,6 +29,9 @@ class Region extends AbstractSeed
|
||||
if (str_contains($column, 'id')) {
|
||||
return 'id';
|
||||
}
|
||||
if (str_contains($column, 'numeracion')) {
|
||||
return 'numeracion';
|
||||
}
|
||||
return $column;
|
||||
}, $columns);
|
||||
$data = array_map(function ($row) use ($columns) {
|
||||
|
52
app/resources/database/seeds/TipoPago.php
Normal file
52
app/resources/database/seeds/TipoPago.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Seed\AbstractSeed;
|
||||
|
||||
class TipoPago extends AbstractSeed
|
||||
{
|
||||
/**
|
||||
* Run Method.
|
||||
*
|
||||
* Write your database seeder using this method.
|
||||
*
|
||||
* More information on writing seeders is available here:
|
||||
* https://book.cakephp.org/phinx/0/en/seeding.html
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$table = $this->table('tipo_pago');
|
||||
$data = [
|
||||
[
|
||||
'descripcion' => 'cheque',
|
||||
],
|
||||
[
|
||||
'descripcion' => 'carta de resguardo',
|
||||
],
|
||||
[
|
||||
'descripcion' => 'vale vista'
|
||||
],
|
||||
[
|
||||
'descripcion' => 'deposito',
|
||||
],
|
||||
[
|
||||
'descripcion' => 'efectivo',
|
||||
],
|
||||
[
|
||||
'descripcion' => 'tarjeta de credito',
|
||||
],
|
||||
[
|
||||
'descripcion' => 'transferencia electronica',
|
||||
],
|
||||
[
|
||||
'descripcion' => 'virtual',
|
||||
]
|
||||
];
|
||||
|
||||
$table->truncate();
|
||||
$table
|
||||
->insert($data)
|
||||
->saveData();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user