Current state

This commit is contained in:
2026-02-07 08:23:18 +01:00
commit 0a4372c40d
22479 changed files with 1553543 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
<?php
namespace Database\Factories;
use App\Models\Artwork;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class ArtworkFactory extends Factory
{
protected $model = Artwork::class;
public function definition(): array
{
$title = $this->faker->unique()->sentence(3);
return [
'user_id' => User::factory(),
'title' => $title,
'slug' => Str::slug($title) . '-' . $this->faker->unique()->randomNumber(5),
'description' => $this->faker->paragraph(),
'file_name' => 'image.jpg',
'file_path' => 'uploads/artworks/image.jpg',
'file_size' => 12345,
'mime_type' => 'image/jpeg',
'width' => 800,
'height' => 600,
'is_public' => true,
'is_approved' => true,
'published_at' => now()->subDay(),
];
}
public function unpublished(): self
{
return $this->state(fn () => ['published_at' => null]);
}
public function private(): self
{
return $this->state(fn () => ['is_public' => false]);
}
public function unapproved(): self
{
return $this->state(fn () => ['is_approved' => false]);
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}