'billets' table + pages
This commit is contained in:
27
laravel/database/factories/BilletFactory.php
Normal file
27
laravel/database/factories/BilletFactory.php
Normal 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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
18
laravel/database/seeders/BilletSeeder.php
Normal file
18
laravel/database/seeders/BilletSeeder.php
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user