Permission::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace Ultraware\Roles\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Ultraware\Roles\Contracts\PermissionHasRelations as PermissionHasRelationsContract;
7
use Ultraware\Roles\Traits\PermissionHasRelations;
8
use Ultraware\Roles\Traits\Slugable;
9
10
class Permission extends Model implements PermissionHasRelationsContract
11
{
12
    use Slugable, PermissionHasRelations;
13
14
    /**
15
     * The attributes that are mass assignable.
16
     *
17
     * @var array
18
     */
19
    protected $fillable = ['name', 'slug', 'description', 'model'];
20
21
    /**
22
     * Create a new model instance.
23
     *
24
     * @param array $attributes
25
     */
26
    public function __construct(array $attributes = [])
27
    {
28
        parent::__construct($attributes);
29
30
        if ($connection = config('roles.connection')) {
31
            $this->connection = $connection;
32
        }
33
    }
34
}
35