Completed
Push — master ( 434bf1...28f331 )
by Phecho
03:35
created

Comment   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 42
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getPresenterClass() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of Gitamin.
5
 * 
6
 * Copyright (C) 2015-2016 The Gitamin Team
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
# == Schema Information
13
#
14
# Table name: comments
15
#
16
#  id            :integer          not null, primary key
17
#  message       :text
18
#  target_type   :string(255)
19
#  author_id     :integer
20
#  created_at    :datetime
21
#  updated_at    :datetime
22
#  project_id    :integer
23
#  attachment    :string(255)
24
#  line_code     :string(255)
25
#  commit_id     :string(255)
26
#  target_id     :integer
27
#  system        :boolean          default(FALSE), not null
28
#  st_diff       :text
29
#  updated_by_id :integer
30
#  is_award      :boolean
31
#
32
33
namespace Gitamin\Models;
34
35
use AltThree\Validator\ValidatingTrait;
36
use Gitamin\Presenters\CommentPresenter;
37
use Illuminate\Database\Eloquent\Model;
38
use Illuminate\Database\Eloquent\SoftDeletes;
39
use McCool\LaravelAutoPresenter\HasPresenter;
40
41
class Comment extends Model implements HasPresenter
42
{
43
    use SoftDeletes, ValidatingTrait;
44
45
    /**
46
     * The fillable properties.
47
     *
48
     * @var string[]
49
     */
50
    protected $fillable = [
51
        'author_id',
52
        'project_id',
53
        'message',
54
        'target_type',
55
        'target_id',
56
        'created_at',
57
        'updated_at',
58
    ];
59
60
    /**
61
     * The validation rules.
62
     *
63
     * @var string[]
64
     */
65
    public $rules = [
66
        'author_id'   => 'int',
67
        'project_id'  => 'int',
68
        'message'     => 'required',
69
        'target_type' => 'string|required',
70
        'target_id'   => 'int',
71
    ];
72
73
    /**
74
     * Get the presenter class.
75
     *
76
     * @return string
77
     */
78
    public function getPresenterClass()
79
    {
80
        return CommentPresenter::class;
81
    }
82
}
83