Skip to content
Snippets Groups Projects
Commit e0835a09 authored by Eric WAGNER's avatar Eric WAGNER
Browse files

php artisan make:foactory StudentFactory + AppServiceProvider + php artisan db:seed

parent e06238e6
Branches
No related merge requests found
......@@ -19,6 +19,17 @@ public function register(): void
*/
public function boot(): void
{
//
Schema::defaultStringLength(191);
$base_path = parse_url(url('/'), PHP_URL_PATH);
if ($base_path) {
Livewire::setScriptRoute(function ($handle) use ($base_path) {
return Route::get($base_path . '/livewire/livewire.js', $handle);
});
Livewire::setUpdateRoute(function ($handle) use ($base_path) {
return Route::post($base_path . '/livewire/update', $handle);
});
}
}
}
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Student>
*/
class StudentFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'firstname' => $this->faker->firstName(),
'lastname' => $this->faker->lastName(),
'email' => $this->faker->unique()->safeEmail(),
];
}
}
......@@ -12,11 +12,6 @@ class DatabaseSeeder extends Seeder
*/
public function run(): void
{
// \App\Models\User::factory(10)->create();
// \App\Models\User::factory()->create([
// 'name' => 'Test User',
// 'email' => 'test@example.com',
// ]);
Student::factory(10)->create();
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment