|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Database\Factories; |
|
4
|
|
|
|
|
5
|
|
|
use App\Models\Event; |
|
6
|
|
|
use App\Models\EventRepetition; |
|
7
|
|
|
use App\Repositories\EventRepetitionRepository; |
|
8
|
|
|
use Carbon\Carbon; |
|
9
|
|
|
use Faker\Provider\DateTime; |
|
10
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory; |
|
11
|
|
|
|
|
12
|
|
|
class EventFactory extends Factory |
|
13
|
|
|
{ |
|
14
|
|
|
private Carbon $randomDate1; |
|
|
|
|
|
|
15
|
|
|
private Carbon $randomDate2; |
|
|
|
|
|
|
16
|
|
|
private Carbon $randomDate3; |
|
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* The name of the factory's corresponding model. |
|
20
|
|
|
* |
|
21
|
|
|
* @var string |
|
22
|
|
|
*/ |
|
23
|
|
|
protected $model = Event::class; |
|
24
|
|
|
|
|
25
|
|
|
protected ?string $startDate = null; |
|
26
|
|
|
protected ?string $endDate = null; |
|
27
|
|
|
protected ?string $timeStart = null; |
|
28
|
|
|
protected ?string $timeEnd = null; |
|
29
|
|
|
protected ?string $repeatUntil = null; |
|
30
|
|
|
protected ?string $onMonthlyKind = null; |
|
31
|
|
|
|
|
32
|
|
|
|
|
33
|
|
|
// private ?string $val = null; |
|
34
|
|
|
|
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Define the model's default state. |
|
38
|
|
|
* |
|
39
|
|
|
* @return array |
|
40
|
|
|
*/ |
|
41
|
|
|
public function definition() |
|
42
|
|
|
{ |
|
43
|
|
|
return [ |
|
44
|
|
|
'title' => $this->faker->sentence($nbWords = 2, $variableNbWords = true), |
|
45
|
|
|
'description' => $this->faker->text($maxNbChars = 1200), |
|
46
|
|
|
'contact_email' => $this->faker->email, |
|
47
|
|
|
'website_event_link' => $this->faker->url, |
|
48
|
|
|
'facebook_event_link' => $this->faker->url, |
|
49
|
|
|
'venue_id' => $this->faker->numberBetween($min = 1, $max = 3), |
|
50
|
|
|
'event_category_id' => $this->faker->numberBetween($min = 1, $max = 3), |
|
51
|
|
|
'user_id' => 1, |
|
52
|
|
|
'repeat_type' => 1, // If not specified the event created is one time event |
|
53
|
|
|
'is_published' => $this->faker->boolean(50), |
|
54
|
|
|
]; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
|
|
58
|
|
|
} |
|
59
|
|
|
|