Passed
Push — master ( f289b8...9f5103 )
by Davide
72:35 queued 38:03
created

EventCategory::getCategoryName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace DavideCasiraghi\LaravelEventsCalendar\Models;
4
5
use Astrotomic\Translatable\Translatable;
6
use Illuminate\Database\Eloquent\Model;
7
8
class EventCategory extends Model
9
{
10
    /***************************************************************************/
11
    /**
12
     * The table associated with the model.
13
     *
14
     * @var string
15
     */
16
    protected $table = 'event_categories';
17
18
    /***************************************************************************/
19
20
    use Translatable;
0 ignored issues
show
Bug introduced by
The trait Astrotomic\Translatable\Translatable requires the property $each which is not provided by DavideCasiraghi\LaravelE...ar\Models\EventCategory.
Loading history...
21
22
    public $translatedAttributes = ['name', 'slug'];
23
    protected $fillable = [];
24
    public $useTranslationFallback = true;
25
26
    /***************************************************************************/
27
28
    /*
29
     * Return the category name.
30
     *
31
     * @param  int  $categoryId
32
     * @return string
33
     */
34 1
    public static function getCategoryName($categoryId)
35
    {
36 1
        $ret = self::find($categoryId)->name;
37
38 1
        return $ret;
39
    }
40
}
41