Completed
Push — master ( 6ea7ff...8c9744 )
by Ariel
11:07
created

Humanresource::save()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 6
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Timegridio\Concierge\Models;
4
5
use Illuminate\Database\Eloquent\Model as EloquentModel;
6
use Illuminate\Database\Eloquent\Relations\BelongsTo;
7
use Timegridio\Concierge\Models\Business;
8
9 View Code Duplication
class Humanresource extends EloquentModel
0 ignored issues
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...
10
{
11
    /**
12
     * The attributes that are mass assignable.
13
     *
14
     * @var array
15
     */
16
    protected $fillable = ['name', 'capacity'];
17
18
    protected $guarded = ['id', 'slug'];
19
20
    /**
21
     * Has many human resources.
22
     *
23
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
24
     */
25 1
    public function business()
26
    {
27 1
        return $this->belongsTo(Business::class);
28
    }
29
30
    /**
31
     * TODO: Check slug setting can be moved to a more proper place.
32
     *
33
     * Save the model to the database.
34
     *
35
     * @param array $options
36
     *
37
     * @return bool
38
     */
39 4
    public function save(array $options = [])
40
    {
41 4
        $this->attributes['slug'] = str_slug($this->attributes['name']);
42
43 4
        return parent::save($options);
44
    }
45
}
46