1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* rmarchiv.tk |
5
|
|
|
* (c) 2016-2017 by Marcel 'ryg' Hering |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace App\Models; |
9
|
|
|
|
10
|
|
|
use Illuminate\Database\Eloquent\Model; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Class AwardSubcat. |
14
|
|
|
* |
15
|
|
|
* @property int $id |
16
|
|
|
* @property string $title |
17
|
|
|
* @property string $desc_html |
18
|
|
|
* @property string $desc_md |
19
|
|
|
* @property \Carbon\Carbon $created_at |
20
|
|
|
* @property \Carbon\Carbon $updated_at |
21
|
|
|
* @property int $page_id |
22
|
|
|
* @property int $cat_id |
23
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\AwardSubcat whereId($value) |
24
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\AwardSubcat whereTitle($value) |
25
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\AwardSubcat whereDescHtml($value) |
26
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\AwardSubcat whereDescMd($value) |
27
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\AwardSubcat whereCreatedAt($value) |
28
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\AwardSubcat whereUpdatedAt($value) |
29
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\AwardSubcat wherePageId($value) |
30
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\AwardSubcat whereCatId($value) |
31
|
|
|
* @mixin \Eloquent |
32
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Venturecraft\Revisionable\Revision[] $revisionHistory |
33
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\GamesAward[] $game_awards |
34
|
|
|
* @property-read \App\Models\AwardCat $award_cat |
35
|
|
|
*/ |
36
|
|
View Code Duplication |
class AwardSubcat extends Model |
|
|
|
|
37
|
|
|
{ |
38
|
|
|
use \Venturecraft\Revisionable\RevisionableTrait; |
39
|
|
|
public $timestamps = true; |
|
|
|
|
40
|
|
|
protected $table = 'award_subcats'; |
|
|
|
|
41
|
|
|
protected $fillable = [ |
42
|
|
|
'title', |
43
|
|
|
'desc_html', |
44
|
|
|
'desc_md', |
45
|
|
|
'page_id', |
46
|
|
|
'cat_id', |
47
|
|
|
]; |
48
|
|
|
|
49
|
|
|
protected $guarded = []; |
50
|
|
|
|
51
|
|
|
public function game_awards() |
|
|
|
|
52
|
|
|
{ |
53
|
|
|
return $this->hasMany('App\Models\GamesAward', 'award_subcat_id', 'id')->orderBy('place'); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function award_cat() |
57
|
|
|
{ |
58
|
|
|
return $this->hasOne('App\Models\AwardCat', 'id', 'cat_id'); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|
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.