Mercurial > packages > magicforger
annotate src/Generator/Factory/stubs/factory.stub @ 36:76584181267a ls_dev_2025_09
Got factories working in a basic way, not sure how complex tables will handle it though
| author | Luka Sitas <sitas.luka.97@gmail.com> |
|---|---|
| date | Sat, 20 Sep 2025 17:14:29 -0400 |
| parents | 55d2e5c5dad9 |
| children |
| rev | line source |
|---|---|
|
35
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
1 <?php |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
2 |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
3 namespace Database\Factories; |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
4 |
|
36
76584181267a
Got factories working in a basic way, not sure how complex tables will handle it though
Luka Sitas <sitas.luka.97@gmail.com>
parents:
35
diff
changeset
|
5 use {{ namespacedModel }}; |
|
35
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
6 use Illuminate\Database\Eloquent\Factories\Factory; |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
7 use Illuminate\Support\Facades\Hash; |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
8 use Illuminate\Support\Str; |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
9 |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
10 /** |
|
36
76584181267a
Got factories working in a basic way, not sure how complex tables will handle it though
Luka Sitas <sitas.luka.97@gmail.com>
parents:
35
diff
changeset
|
11 * @extends \Illuminate\Database\Eloquent\Factories\Factory<{{ namespacedModel }}> |
|
35
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
12 */ |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
13 class {{ class }} extends Factory |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
14 { |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
15 |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
16 /** |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
17 * The name of the factory's corresponding model. |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
18 * |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
19 * @var class-string<\Illuminate\Database\Eloquent\Model> |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
20 */ |
|
36
76584181267a
Got factories working in a basic way, not sure how complex tables will handle it though
Luka Sitas <sitas.luka.97@gmail.com>
parents:
35
diff
changeset
|
21 protected $model = {{ model }}::class; |
|
35
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
22 |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
23 /** |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
24 * Define the model's default state. |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
25 * |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
26 * @return array<string, mixed> |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
27 */ |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
28 public function definition(): array |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
29 { |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
30 return [ |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
31 # {{ factoryInsertPoint }} |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
32 ]; |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
33 } |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
34 |
|
55d2e5c5dad9
Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents:
diff
changeset
|
35 } |
