Carga inicial
This commit is contained in:
90
database/seeds/VehiculosTableSeeder.php
Normal file
90
database/seeds/VehiculosTableSeeder.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class VehiculosTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run(Faker\Generator $faker)
|
||||
{
|
||||
|
||||
for ($i = 1; $i<=49 ; $i++){
|
||||
|
||||
$tipo_vehiculo_id = 0;
|
||||
|
||||
if($i == 2 || $i == 8 || $i == 11 || $i == 17 || $i == 23 || $i == 27 || $i == 30 || $i == 34 || $i == 36 || $i == 39 || $i == 40 || $i == 46 || $i == 50){
|
||||
$tipo_vehiculo_id = 1;
|
||||
}
|
||||
|
||||
if($i == 4 || $i == 7 || $i == 16 || $i == 28 || $i == 38 || $i == 49){
|
||||
$tipo_vehiculo_id = 2;
|
||||
}
|
||||
|
||||
if($i == 10){
|
||||
$tipo_vehiculo_id = 3;
|
||||
}
|
||||
|
||||
if($i == 12){
|
||||
$tipo_vehiculo_id = 4;
|
||||
}
|
||||
|
||||
if($i == 13 || $i == 33){
|
||||
$tipo_vehiculo_id = 5;
|
||||
}
|
||||
|
||||
if($i == 19 || $i == 26 || $i == 47){
|
||||
$tipo_vehiculo_id = 6;
|
||||
}
|
||||
|
||||
if($i == 22){
|
||||
$tipo_vehiculo_id = 7;
|
||||
}
|
||||
|
||||
if($i == 24){
|
||||
$tipo_vehiculo_id = 8;
|
||||
}
|
||||
|
||||
if($i == 32){
|
||||
$tipo_vehiculo_id = 9;
|
||||
}
|
||||
|
||||
if($i == 37){
|
||||
$tipo_vehiculo_id = 10;
|
||||
}
|
||||
|
||||
if($i == 41 || $i == 44){
|
||||
$tipo_vehiculo_id = 11;
|
||||
}
|
||||
|
||||
if($i == 48){
|
||||
$tipo_vehiculo_id = 12;
|
||||
}
|
||||
|
||||
if($tipo_vehiculo_id == 0){
|
||||
$tipo_vehiculo_id = 1;
|
||||
|
||||
$data = [
|
||||
'num_economico' => "M$i",
|
||||
'tipo_vehiculo_id' => $tipo_vehiculo_id,
|
||||
'created_at' => Carbon::now()->toDateTimeString(),
|
||||
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||
'deleted_at' => Carbon::now()->toDateTimeString(),
|
||||
];
|
||||
}else{
|
||||
$data = [
|
||||
'num_economico' => "M$i",
|
||||
'tipo_vehiculo_id' => $tipo_vehiculo_id,
|
||||
'created_at' => Carbon::now()->toDateTimeString(),
|
||||
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||
];
|
||||
}
|
||||
|
||||
DB::table('cat_vehiculos')->insert($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user