TicketActivity::targetable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
4
namespace RexlManu\LaravelTickets\Models;
5
6
7
use Illuminate\Database\Eloquent\Model;
8
use RexlManu\LaravelTickets\Traits\HasConfigModel;
9
10
/**
11
 * Class TicketActivity
12
 *
13
 * This data model is used to log every action that was fired by a interaction
14
 *
15
 * @package RexlManu\LaravelTickets\Models
16
 */
17 View Code Duplication
class TicketActivity extends Model
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
{
19
    use HasConfigModel;
20
21
    protected $fillable = [
22
        'type'
23
    ];
24
25
    /**
26
     * Gives the ticket that the activity belongs to
27
     *
28
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
29
     */
30
    public function ticket()
31
    {
32
        return $this->belongsTo(Ticket::class, 'ticket_id');
33
    }
34
35
    public function getTable()
36
    {
37
        return config('laravel-tickets.database.ticket-activities-table');
38
    }
39
40
    /**
41
     * Gives the target, can be ticket, user or message
42
     *
43
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
44
     */
45
    public function targetable()
46
    {
47
        return $this->morphTo();
48
    }
49
}
50