add faults (routes, model, navigation, seeder and migration)
All checks were successful
Build, push and deploy / builds (push) Successful in 5s
All checks were successful
Build, push and deploy / builds (push) Successful in 5s
This commit is contained in:
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('faults', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('contact_name'); // This column must exist
|
||||
$table->string('contact_phone');
|
||||
$table->text('description');
|
||||
$table->string('address');
|
||||
$table->string('status');
|
||||
$table->string('google_maps_link');
|
||||
$table->string('city');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('faults');
|
||||
}
|
||||
};
|
@ -3,6 +3,8 @@
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Fault;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
@ -53,6 +55,31 @@ class DatabaseSeeder extends Seeder
|
||||
$user->assignRole($userData['role']);
|
||||
}
|
||||
}
|
||||
|
||||
Fault::firstOrCreate([
|
||||
'contact_name' => 'Anthony',
|
||||
'contact_phone' => '666767222',
|
||||
'description' => 'No tenemos luz en el garaje',
|
||||
'address' => 'Carrer del mig, 4',
|
||||
'status' => 'En espera',
|
||||
'google_maps_link' => 'https://maps.google.com/long/url/link',
|
||||
'city' => 'Algemesi',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
Fault::firstOrCreate([
|
||||
'contact_name' => 'Amparo',
|
||||
'contact_phone' => '74645657',
|
||||
'description' => 'Se ha roto el reloj',
|
||||
'address' => 'Plaza Mayor 1',
|
||||
'status' => 'Realizado',
|
||||
'google_maps_link' => 'https://maps.google.com/long/url/link',
|
||||
'city' => 'Cataroja',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user