Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Pull Request — development (#51)
by José
03:55
created

Campaign::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 1.0046

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 10
loc 10
ccs 5
cts 6
cp 0.8333
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
crap 1.0046
1
<?php
2
3
namespace DoeSangue\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\SoftDeletes;
7
use DoeSangue\Models\User;
8
use DoeSangue\Models\Comment;
9
use Webpatser\Uuid\Uuid;
10
11 View Code Duplication
class Campaign extends Model
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
14
    use SoftDeletes;
15
16
    /**
17
     * The table associated with the model.
18
     *
19
     * @var string
20
     */
21
    protected $table = 'campaigns';
22
23
    /**
24
     * Indicates if the IDs are auto-incrementing.
25
     *
26
     * @var bool
27
     */
28
    public $incrementing = false;
29
30
    /**
31
     * The attributes that are mass assignable.
32
     *
33
     * @var array
34
     */
35
    protected $filliable = [ 'title', 'description', 'image', 'expires', 'user_id' ];
36
37
    protected $hidden = [ 'created_at', 'updated_at', 'deleted_at', 'user_id' ];
38
39
    protected $dates = [
40
      'created_at', 'updated_at', 'deleted_at'
41
    ];
42
43
    /**
44
     * Return the owner of campaign
45
     */
46
    public function owner()
47
    {
48
        return $this->belongsTo(User::class, 'user_id');
49
    }
50
51
    public function comments()
52
    {
53
        return $this->hasMany(Comment::class);
54
    }
55
56
    /**
57
     * Generate automaticaly the Campaign id(uuid).
58
     *
59
     * @return Webpatser\Uuid\Uuid::generate()
0 ignored issues
show
Documentation introduced by
The doc-type Webpatser\Uuid\Uuid::generate() could not be parsed: Unknown type name "Webpatser\Uuid\Uuid::generate" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
60
     */
61 1
    public static function boot()
62
    {
63 1
        parent::boot();
64 1
        self::creating(
65 1
            function($model) {
66
                // Generate a version 4 Uuid.
67
                $model->id = (string) Uuid::generate(4)->string;
68 1
            }
69
        );
70
    }
71
}
72