]> BookStack Code Mirror - bookstack/blob - database/factories/Sorting/SortSetFactory.php
36e0a697677452867ef57990808110f239092eae
[bookstack] / database / factories / Sorting / SortSetFactory.php
1 <?php
2
3 namespace Database\Factories\Sorting;
4
5 use BookStack\Sorting\SortSet;
6 use BookStack\Sorting\SortSetOperation;
7 use Illuminate\Database\Eloquent\Factories\Factory;
8
9 class SortSetFactory extends Factory
10 {
11     /**
12      * The name of the factory's corresponding model.
13      *
14      * @var string
15      */
16     protected $model = SortSet::class;
17
18     /**
19      * Define the model's default state.
20      */
21     public function definition(): array
22     {
23         $cases = SortSetOperation::cases();
24         $op = $cases[array_rand($cases)];
25         return [
26             'name' => $op->name . ' Sort',
27             'sequence' => $op->value,
28         ];
29     }
30 }