You've already forked Atomcms-edit
fix: standardize language to English in README and AlertSettings
feat: add 24 model factories for Help, Shop, Community, Game, User domains - Translate mixed Dutch/English strings in README.md and AlertSettings.php - Add HasFactory trait to 23 models - Create factories for Help (6), Shop (4), Community (5), Game (2), User (7)
This commit is contained in:
Executable
+38
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories\User;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\User\Ban;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class BanFactory extends Factory
|
||||
{
|
||||
protected $model = Ban::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => User::factory(),
|
||||
'user_staff_id' => User::factory(),
|
||||
'ban_expire' => now()->addDays($this->faker->numberBetween(1, 365))->timestamp,
|
||||
'type' => $this->faker->randomElement(['account', 'ip', 'machine']),
|
||||
'reason' => $this->faker->sentence(),
|
||||
'ip' => $this->faker->ipv4(),
|
||||
];
|
||||
}
|
||||
|
||||
public function expired(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'ban_expire' => now()->subDay()->timestamp,
|
||||
]);
|
||||
}
|
||||
|
||||
public function permanent(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'ban_expire' => 0,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user