BlockedType   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 94
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 23
dl 0
loc 94
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A blockedItems() 0 3 1
A getTableName() 0 3 1
A getConnectionName() 0 3 1
1
<?php
2
3
namespace jeremykenedy\LaravelBlocker\App\Models;
4
5
use Illuminate\Database\Eloquent\Model;
0 ignored issues
show
Bug introduced by
The type Illuminate\Database\Eloquent\Model was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Illuminate\Database\Eloquent\SoftDeletes;
0 ignored issues
show
Bug introduced by
The type Illuminate\Database\Eloquent\SoftDeletes was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
class BlockedType extends Model
9
{
10
    use SoftDeletes;
11
12
    /**
13
     * The table associated with the model.
14
     *
15
     * @var string
16
     */
17
    protected $table;
18
19
    /**
20
     * The connection name for the model.
21
     *
22
     * @var string
23
     */
24
    protected $connection;
25
26
    /**
27
     * Indicates if the model should be timestamped.
28
     *
29
     * @var bool
30
     */
31
    public $timestamps = true;
32
33
    /**
34
     * The attributes that are not mass assignable.
35
     *
36
     * @var array
37
     */
38
    protected $guarded = [
39
        'id',
40
    ];
41
42
    /**
43
     * The attributes that should be mutated to dates.
44
     *
45
     * @var array
46
     */
47
    protected $dates = [
48
        'created_at',
49
        'updated_at',
50
        'deleted_at',
51
    ];
52
53
    /**
54
     * Fillable fields.
55
     *
56
     * @var array
57
     */
58
    protected $fillable = [
59
        'slug',
60
        'name',
61
    ];
62
63
    protected $casts = [
64
        'slug' => 'string',
65
        'name' => 'string',
66
    ];
67
68
    /**
69
     * Create a new instance to set the table and connection.
70
     *
71
     * @return void
72
     */
73
    public function __construct($attributes = [])
74
    {
75
        parent::__construct($attributes);
76
        $this->connection = config('laravelblocker.blockerDatabaseConnection');
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

76
        $this->connection = /** @scrutinizer ignore-call */ config('laravelblocker.blockerDatabaseConnection');
Loading history...
77
        $this->table = config('laravelblocker.blockerTypeDatabaseTable');
78
    }
79
80
    /**
81
     * Get the database connection.
82
     */
83
    public function getConnectionName()
84
    {
85
        return $this->connection;
86
    }
87
88
    /**
89
     * Get the database table.
90
     */
91
    public function getTableName()
92
    {
93
        return $this->table;
94
    }
95
96
    /**
97
     * Get the blockedItems for the BlockedType.
98
     */
99
    public function blockedItems()
100
    {
101
        return $this->hasMany(BlockedItem::class);
102
    }
103
}
104