Passed
Push — master ( 8372f4...8e3d45 )
by Davide
07:49 queued 11s
created

Region::getRegionName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 2
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 10
c 1
b 1
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace DavideCasiraghi\LaravelEventsCalendar\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Astrotomic\Translatable\Translatable;
7
8
class Region extends Model
9
{
10
    /***************************************************************************/
11
    /**
12
     * The table associated with the model.
13
     *
14
     * @var string
15
     */
16
    protected $table = 'regions';
17
18
    /***************************************************************************/
19
20
    use Translatable;
21
22
    public $translatedAttributes = ['name', 'slug'];
23
    protected $fillable = ['country_id','timezone'];
24
    public $useTranslationFallback = true;
25
26
    /***************************************************************************/
27
28
    /*
29
     * Return the region name.
30
     *
31
     * @param  int  $regionId
32
     * @return string
33
     */
34
    public static function getRegionName($regionId)
35
    {
36
        $ret = self::find($regionId)->name;
37
38
        return $ret;
39
    }
40
    
41
42
}
43