CommentFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 10
dl 0
loc 20
rs 10
c 1
b 0
f 1
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A definition() 0 11 1
1
<?php
2
3
namespace Usamamuneerchaudhary\Commentify\Database\Factories;
4
5
use Illuminate\Database\Eloquent\Factories\Factory;
6
use Illuminate\Support\Str;
7
use Usamamuneerchaudhary\Commentify\Models\Comment;
8
use Usamamuneerchaudhary\Commentify\Models\User;
9
10
11
class CommentFactory extends Factory
12
{
13
    protected $model = Comment::class;
14
15
    /**
16
     * Define the model's default state.
17
     *
18
     * @return array<string, mixed>
19
     */
20
    public function definition(): array
21
    {
22
        return [
23
            'body' => fake()->text,
24
            'user_id' => function () {
25
                return User::factory()->create()->id;
26
            },
27
            'parent_id' => null,
28
            'commentable_type' => '\ArticleStub',
29
            'commentable_id' => 1,
30
            'created_at' => now()
31
        ];
32
    }
33
}
34