Completed
Push — master ( 33fa22...fb5d13 )
by Faiq
28s
created

DoctorSpecialization::doctor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class DoctorSpecialization extends Model
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $table = 'doctor_specializations';
13
14
    /**
15
     * @var string
16
     */
17
    public $primaryKey = 'id';
18
19
    /**
20
     * @var bool
21
     */
22
    public $timestamps = true;
23
24
    /**
25
     * @var array
26
     */
27
    protected $dates = [
28
        'created_at',
29
        'updated_at'
30
    ];
31
32
    public function doctor() {
33
        return $this->hasOne('App\Doctor', 'specialization_id');
34
    }
35
36
    /**
37
     * @param $str
38
     * @return string
39
     */
40
    public function trimStr($str)
41
    {
42
        if(strlen($str) > 15) {
43
            return substr($str, 0, 15)."...";
44
        }
45
        return $str;
46
    }
47
}
48