GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( ea9462...f6a83c )
by Nikhil
10:26
created

Supplier::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
3
namespace App;
4
5
use Illuminate\Database\Eloquent;
6
7
/**
8
 * App\Supplier
9
 *
10
 * @property integer $id
11
 * @property string $name
12
 * @property string $location
13
 * @property \Carbon\Carbon $deleted_at
14
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Purchase[] $purchases
15
 * @method static \Illuminate\Database\Query\Builder|\App\Supplier whereId($value)
16
 * @method static \Illuminate\Database\Query\Builder|\App\Supplier whereName($value)
17
 * @method static \Illuminate\Database\Query\Builder|\App\Supplier whereLocation($value)
18
 * @method static \Illuminate\Database\Query\Builder|\App\Supplier whereDeletedAt($value)
19
 * @mixin \Eloquent
20
 */
21
class Supplier extends Eloquent\Model
22
{
23
    use Eloquent\SoftDeletes;
24
25
    /**
26
     * We do not want any timestamps.
27
     *
28
     * @var bool
29
     */
30
    public $timestamps = false;
31
    /**
32
     * @var array
33
     */
34
    protected $dates = ['deleted_at'];
35
    /**
36
     * The attributes that are mass assignable.
37
     *
38
     * @var array
39
     */
40
    protected $fillable = ['name', 'location'];
41
42 11
    public static function boot()
43
    {
44 11
        parent::boot();
45
46 11
        static::deleting(function (Supplier $supplier) {
47
            $supplier->purchases()->delete();
48 11
        });
49 11
    }
50
51
    /**
52
     * Make a purchase.
53
     *
54
     * @param array $attributes
55
     *
56
     * @return Purchase
57
     */
58 1
    public function makePurchase(array $attributes)
59
    {
60 1
        return $this->purchases()->create($attributes);
61
    }
62
63
    /**
64
     * Purchases from this supplier.
65
     *
66
     * @return Eloquent\Relations\HasMany
67
     */
68 1
    public function purchases()
69
    {
70 1
        return $this->hasMany(Purchase::class);
71
    }
72
}
73