mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
feat: add config variable menu
This commit is contained in:
37
ci4/app/Database/Seeds/DefaultConfigVariablesSeeder.php
Normal file
37
ci4/app/Database/Seeds/DefaultConfigVariablesSeeder.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Seeds;
|
||||
|
||||
use App\Models\Configuracion\ConfigVariableModel;
|
||||
use CodeIgniter\Database\Seeder;
|
||||
|
||||
class DefaultConfigVariablesSeeder extends Seeder
|
||||
{
|
||||
protected array $data = [
|
||||
[
|
||||
"name" => "tamanio_solapas_min",
|
||||
"value" => 50,
|
||||
"description" => "Mínimo tamaño solapas"
|
||||
],
|
||||
[
|
||||
"name" => "tamanio_solapas_max",
|
||||
"value" => 150,
|
||||
"description" => "Máximo tamaño solapas"
|
||||
],
|
||||
[
|
||||
"name" => "limite_produccion_diaria",
|
||||
"value" => 6000,
|
||||
"description" => "Número de libros máximos que se puede producir al día"
|
||||
],
|
||||
];
|
||||
public function run()
|
||||
{
|
||||
|
||||
$variableModel = model(ConfigVariableModel::class);
|
||||
foreach ($this->data as $row) {
|
||||
if($variableModel->where("name",$row["name"])->first() == null){
|
||||
$variableModel->insert($row);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user