Emoji::created_by()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 2 Features 0
Metric Value
c 5
b 2
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * @author   Temitope Olotin <[email protected]>
4
 * @license  <https://opensource.org/license/MIT> MIT
5
 */
6
namespace Laztopaz\EmojiRestfulAPI;
7
8
use Illuminate\Database\Eloquent\Model;
9
10
class Emoji extends Model
11
{
12
    protected $fillable = ['name', 'char', 'category', 'created_by', 'created_at', 'updated_at'];
13
14
    /**
15
     * Get emoji keywords.
16
     */
17
    public function keywords()
18
    {
19
        return $this->hasMany('Laztopaz\EmojiRestfulAPI\Keyword')->select(['emoji_id', 'keyword_name']);
20
    }
21
22
    /**
23
     * Get emoji category.
24
     */
25
    public function category()
26
    {
27
        return $this->hasOne('Laztopaz\EmojiRestfulAPI\Category', 'id', 'category')->select('id', 'category_name');
28
    }
29
30
    /**
31
     * Get emoji creator.
32
     */
33
    public function created_by()
34
    {
35
        return $this->hasOne('Laztopaz\EmojiRestfulAPI\User', 'id', 'created_by');
36
    }
37
}
38