Passed
Pull Request — master (#17)
by Stephen
14:26
created

RoleFactory::definition()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 7
rs 10
c 1
b 0
f 1
1
<?php
2
3
namespace Database\Factories;
4
5
use Illuminate\Database\Eloquent\Factories\Factory;
6
use Sfneal\Users\Models\Role;
7
8
class RoleFactory extends Factory
9
{
10
    public const TYPES = ['user', 'client'];
11
    public const NAMES = ['Employee', 'Administrator', 'Team Leader'];
12
13
    /**
14
     * The name of the factory's corresponding model.
15
     *
16
     * @var string
17
     */
18
    protected $model = Role::class;
19
20
    /**
21
     * Define the model's default state.
22
     *
23
     * @return array
24
     */
25
    public function definition(): array
26
    {
27
        return [
28
            'type' => $this->faker->randomElement(self::TYPES),
29
            'name' => $this->faker->randomElement(self::NAMES),
30
            'description' => $this->faker->text(255),
31
            'order' => $this->faker->randomNumber(2),
32
        ];
33
    }
34
}
35