Test Failed
Push — feature-laravel-5.4 ( 475d96...446986 )
by Kirill
07:30
created

Bot::getAvatarAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of laravel.su package.
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace App\Models;
10
11
use Illuminate\Database\Eloquent\Model;
12
use Illuminate\Database\Eloquent\Relations\MorphToMany;
13
14
/**
15
 * Class Bot.
16
 */
17
class Bot extends Model
18
{
19
    private const DEFAULT_AVATAR_PATH = '/static/bots/';
20
21
    /**
22
     * @var string
23
     */
24
    protected $table = 'bots';
25
26
    /**
27
     * @var bool
28
     */
29
    public $timestamps = false;
30
31
    /**
32
     * @param  string $avatar
33
     * @return string
34
     */
35
    public function getAvatarAttribute(string $avatar): string
36
    {
37
        return self::DEFAULT_AVATAR_PATH . $avatar;
38
    }
39
40
    /**
41
     * @return MorphToMany
42
     */
43
    public function articles(): MorphToMany
44
    {
45
        return $this->morphToMany(Article::class, 'user');
46
    }
47
}