UserFactory::definition()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
namespace Database\Factories;
4
5
use Illuminate\Database\Eloquent\Factories\Factory;
6
use Illuminate\Support\Carbon;
7
use Illuminate\Support\Str;
8
9
/**
10
 * @see \App\Models\User
11
 */
12
class UserFactory extends Factory
13
{
14
    /**
15
     * {@inheritDoc}
16
     */
17
    public function definition()
18
    {
19
        return [
20
            'name' => $this->faker->name(),
21
            'email' => $this->faker->unique()->safeEmail(),
22
            'password' => 'password',
23
            'remember_token' => Str::random(10),
24
        ];
25
    }
26
27
    /**
28
     * Indicate that the model's email address should be unverified.
29
     *
30
     * @return \Illuminate\Database\Eloquent\Factories\Factory
31
     */
32
    public function unverified()
33
    {
34
        return $this->state(function (array $attributes) {
0 ignored issues
show
Unused Code introduced by
The parameter $attributes is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

34
        return $this->state(function (/** @scrutinizer ignore-unused */ array $attributes) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
            return [
36
                'email_verified_at' => null,
37
            ];
38
        });
39
    }
40
41
    /**
42
     * Indicate that the model's email address should be verified.
43
     *
44
     * @return \Illuminate\Database\Eloquent\Factories\Factory
45
     */
46
    public function verified()
47
    {
48
        return $this->state(function (array $attributes) {
0 ignored issues
show
Unused Code introduced by
The parameter $attributes is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

48
        return $this->state(function (/** @scrutinizer ignore-unused */ array $attributes) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
49
            return [
50
                'email_verified_at' => Carbon::now(),
51
            ];
52
        });
53
    }
54
}
55