From 2067a49ef6c89c6b0d8c474dbf9a64b162a2325a Mon Sep 17 00:00:00 2001 From: TheSilva7 Date: Wed, 12 Mar 2025 23:13:49 -0600 Subject: [PATCH] Formulario de Tipo de Vehiculos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit le agregamos un pequeño fomulario a tipo de vehiculos relacionado a el tipo de combustible --- app/Models/tiposVeiculos.php | 1 + database/factories/TiposVeiculosFactory.php | 1 + ..._06_162928_create_tipos_veiculos_table.php | 1 + ...po_combustible_to_tipos_veiculos_table.php | 28 +++++++++++++++++++ resources/views/vehiculos.blade.php | 24 ++++++++++++++++ .../views/vehiculosCrearEditar.blade.php | 24 ++++++++++++++++ 6 files changed, 79 insertions(+) create mode 100644 database/migrations/2025_03_13_050724_add_tipo_combustible_to_tipos_veiculos_table.php diff --git a/app/Models/tiposVeiculos.php b/app/Models/tiposVeiculos.php index 7d9a9f9..ae100dc 100644 --- a/app/Models/tiposVeiculos.php +++ b/app/Models/tiposVeiculos.php @@ -10,5 +10,6 @@ class tiposVeiculos extends Model use HasFactory; protected $fillable = [ 'nombre', + 'tipo_combustible', ]; } diff --git a/database/factories/TiposVeiculosFactory.php b/database/factories/TiposVeiculosFactory.php index dd66b1a..9b51bcf 100644 --- a/database/factories/TiposVeiculosFactory.php +++ b/database/factories/TiposVeiculosFactory.php @@ -18,6 +18,7 @@ class TiposVeiculosFactory extends Factory { return [ "nombre"=> $this->faker->name(), + "Tipo de Combustible"=> $this->faker->sentence(), // ]; } diff --git a/database/migrations/2025_03_06_162928_create_tipos_veiculos_table.php b/database/migrations/2025_03_06_162928_create_tipos_veiculos_table.php index 5f82a27..5a7c45a 100644 --- a/database/migrations/2025_03_06_162928_create_tipos_veiculos_table.php +++ b/database/migrations/2025_03_06_162928_create_tipos_veiculos_table.php @@ -14,6 +14,7 @@ return new class extends Migration Schema::create('tipos_veiculos', function (Blueprint $table) { $table->id(); $table->string('nombre'); + $table->string('tipo_combustible'); $table->timestamps(); }); } diff --git a/database/migrations/2025_03_13_050724_add_tipo_combustible_to_tipos_veiculos_table.php b/database/migrations/2025_03_13_050724_add_tipo_combustible_to_tipos_veiculos_table.php new file mode 100644 index 0000000..07722dc --- /dev/null +++ b/database/migrations/2025_03_13_050724_add_tipo_combustible_to_tipos_veiculos_table.php @@ -0,0 +1,28 @@ +string('tipo_combustible')->after('nombre')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('tipos_veiculos', function (Blueprint $table) { + $table->dropColumn('tipo_combustible'); + }); + } +}; diff --git a/resources/views/vehiculos.blade.php b/resources/views/vehiculos.blade.php index 5c00bdd..57a7ab9 100644 --- a/resources/views/vehiculos.blade.php +++ b/resources/views/vehiculos.blade.php @@ -55,6 +55,7 @@ ID Vehículo + Tipo de Combustible Acciones @@ -66,6 +67,29 @@ {{ $vehiculo->nombre }} + + @if($vehiculo->tipo_combustible == 'gasolina_verde') + + + Gasolina Verde + + @elseif($vehiculo->tipo_combustible == 'gasolina_roja') + + + Gasolina Roja + + @elseif($vehiculo->tipo_combustible == 'diesel') + + + Diesel + + @else + + + No especificado + + @endif +
+ +
+ +
+ +
+ +
+
+ @error('tipo_combustible') +

{{ $message }}

+ @enderror +
+