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
Push — master ( 70e47f...dda101 )
by Mark
07:55
created

BaseModel::auditSave()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 7
nc 3
nop 0
dl 0
loc 14
rs 9.2
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Marky
5
 * Date: 17/02/2018
6
 * Time: 23:30
7
 */
8
9
namespace App\Model;
10
11
use Illuminate\Database\Eloquent\Model;
12
13
/**
14
 * Class BaseModel
15
 *
16
 * @property int $editor_id
17
 * @property int $creator_id
18
 *
19
 * @property Account $editor
20
 * @property Account $creator
21
 *
22
 * @package App\Model
23
 */
24
abstract class BaseModel extends Model
25
{
26
27
    /**
28
     * Keep track of editor and creator.
29
     *
30
     * @return bool
31
     * @throws \Exception
32
     */
33
    public function auditSave()
34
    {
35
        if (method_exists($this, 'creator' || method_exists($this, 'editor'))) {
36
            throw new \Exception("Methods 'creator()' & 'editor()' must exist to use auditSave() in {$this->getMorphClass()}");
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 127 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
37
        }
38
39
        if (!$this->creator) {
40
            $this->setAttribute('creator_id', account()->id);
41
        }
42
43
        $this->setAttribute('editor_id', account()->id);
44
45
        return $this->save();
46
    }
47
48
}