'billets' table + pages

This commit is contained in:
Clément
2025-04-15 16:29:47 +02:00
parent 9c129fc03d
commit ea0884d39f
12 changed files with 355 additions and 3 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Billet>
*/
class BilletFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'BIL_DATE' => now(),
'BIL_TITRE' => fake()->text(20),
'BIL_CONTENU' => fake()->text(100),
'created_at' => now(),
'updated_at' => now(),
];
}
}

View File

@@ -0,0 +1,30 @@
<?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('billets', function (Blueprint $table) {
$table->id();
$table->date('BIL_DATE');
$table->text('BIL_TITRE');
$table->text('BIL_CONTENU');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('billets');
}
};

View File

@@ -0,0 +1,18 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Billet;
class BilletSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
Billet::factory(10)->create();
}
}