Estructura de base de datos, migraciones, factories y seeders
This commit is contained in:
@@ -2,8 +2,11 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Foto;
|
||||
use App\Models\Servicio;
|
||||
use App\Models\Profesion;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Servicio>
|
||||
@@ -24,9 +27,24 @@ class ServicioFactory extends Factory
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$fotoDefault = Foto::firstOrCreate(
|
||||
['ruta' => 'images/Servicio.jpg'],
|
||||
[
|
||||
'extension' => 'jpg',
|
||||
'tamanio_bytes' => 0,
|
||||
'nombre' => 'Servicio',
|
||||
'mime_type' => 'image/jpeg',
|
||||
]
|
||||
);
|
||||
|
||||
return [
|
||||
'nombre' => $this->faker->words(3, true),
|
||||
'descripcion' => $this->faker->sentence(12),
|
||||
'titulo' => $this->faker->unique()->bs(),
|
||||
'estado' => 'activo',
|
||||
'descripcion' => $this->faker->sentence(12),
|
||||
'visibleenweb' => 'si',
|
||||
'contenidoweb_id' => DB::table('contenidoswebs')->value('id'),
|
||||
'profesion_id' => Profesion::factory(),
|
||||
'foto_id' => $fotoDefault->id,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user