25 lines
509 B
PHP
25 lines
509 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Tier;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class TierFactory extends Factory
|
|
{
|
|
protected $model = Tier::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'name' => $this->faker->name(),
|
|
'min_spending' => $this->faker->randomNumber(),
|
|
];
|
|
}
|
|
|
|
public function withMaxSpending(int $amount): Factory
|
|
{
|
|
return $this->state(fn () => ['max_spending' => $amount]);
|
|
}
|
|
}
|