Files
thrillwiki_laravel/database/factories/RideFactory.php
pacnpal cc33781245 feat: Implement rides management with CRUD functionality
- Added rides index view with search and filter options.
- Created rides show view to display ride details.
- Implemented API routes for rides.
- Developed authentication routes for user registration, login, and email verification.
- Created tests for authentication, email verification, password reset, and user profile management.
- Added feature tests for rides and operators, including creation, updating, deletion, and searching.
- Implemented soft deletes and caching for rides and operators.
- Enhanced manufacturer and operator model tests for various functionalities.
2025-06-19 22:34:10 -04:00

61 lines
1.5 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Ride;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Ride>
*/
class RideFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Ride::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$name = $this->faker->unique()->words(2, true);
return [
'name' => $name,
'slug' => Str::slug($name),
'description' => $this->faker->paragraphs(2, true),
'is_active' => $this->faker->boolean(90), // 90% chance of being active
'created_at' => $this->faker->dateTimeBetween('-1 year', 'now'),
'updated_at' => function (array $attributes) {
return $this->faker->dateTimeBetween($attributes['created_at'], 'now');
},
];
}
/**
* Indicate that the model is active.
*/
public function active(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => true,
]);
}
/**
* Indicate that the model is inactive.
*/
public function inactive(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => false,
]);
}
}