added tests, bug fixes and cleanup
This commit is contained in:
40
database/factories/EventFactory.php
Normal file
40
database/factories/EventFactory.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Event>
|
||||
*/
|
||||
class EventFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$startDate = Carbon::parse($this->faker->dateTimeBetween('now', '+1 year'));
|
||||
$endDate = Carbon::parse($this->faker->dateTimeBetween($startDate, '+1 year'));
|
||||
$publishDate = Carbon::parse($this->faker->dateTimeBetween('-1 month', '+1 month'));
|
||||
|
||||
return [
|
||||
'title' => $this->faker->sentence(),
|
||||
'location' => $this->faker->randomElement(['online', 'physical']),
|
||||
'address' => $this->faker->address,
|
||||
'start_at' => $startDate,
|
||||
'end_at' => $endDate,
|
||||
'publish_at' => $publishDate,
|
||||
'status' => $this->faker->randomElement(['draft', 'soon', 'open', 'closed', 'cancelled']),
|
||||
'registration_type' => $this->faker->randomElement(['none', 'email', 'link', 'message']),
|
||||
'registration_data' => $this->faker->sentence(),
|
||||
'hero' => $this->faker->uuid,
|
||||
'content' => $this->faker->paragraphs(3, true),
|
||||
'price' => $this->faker->numberBetween(0, 150),
|
||||
'ages' => $this->faker->regexify('\d+(\+|\-\d+)?'),
|
||||
];
|
||||
}
|
||||
}
|
||||
29
database/factories/MediaFactory.php
Normal file
29
database/factories/MediaFactory.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Event>
|
||||
*/
|
||||
class MediaFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'title' => $this->faker->sentence(),
|
||||
'name' => storage_path('app/public/') . $this->faker->slug() . '.' . $this->faker->fileExtension,
|
||||
'mime' => $this->faker->mimeType,
|
||||
'user_id' => $this->faker->uuid,
|
||||
'size' => $this->faker->numberBetween(1000, 1000000),
|
||||
'permission' => null
|
||||
];
|
||||
}
|
||||
}
|
||||
31
database/factories/PostFactory.php
Normal file
31
database/factories/PostFactory.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Event>
|
||||
*/
|
||||
class PostFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$publishDate = Carbon::parse($this->faker->dateTimeBetween('-1 month', '+1 month'));
|
||||
|
||||
return [
|
||||
'title' => $this->faker->sentence(),
|
||||
'slug' => $this->faker->slug(),
|
||||
'publish_at' => $publishDate,
|
||||
'content' => $this->faker->paragraphs(3, true),
|
||||
'user_id' => $this->faker->uuid,
|
||||
'hero' => $this->faker->uuid,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user