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 EventPicture. |
14
|
|
|
* |
15
|
|
|
* @property int $id |
16
|
|
|
* @property int $user_id |
17
|
|
|
* @property int $event_id |
18
|
|
|
* @property string $title |
19
|
|
|
* @property string $desc |
20
|
|
|
* @property string $filename |
21
|
|
|
* @property \Carbon\Carbon $created_at |
22
|
|
|
* @property \Carbon\Carbon $updated_at |
23
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereId($value) |
24
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereUserId($value) |
25
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereEventId($value) |
26
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereTitle($value) |
27
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereDesc($value) |
28
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereFilename($value) |
29
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereCreatedAt($value) |
30
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereUpdatedAt($value) |
31
|
|
|
* @mixin \Eloquent |
32
|
|
|
* @property-read \App\Models\User $user |
33
|
|
|
* @property-read \App\Models\Event $event |
34
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Venturecraft\Revisionable\Revision[] $revisionHistory |
35
|
|
|
*/ |
36
|
|
View Code Duplication |
class EventPicture extends Model |
|
|
|
|
37
|
|
|
{ |
38
|
|
|
use \Venturecraft\Revisionable\RevisionableTrait; |
39
|
|
|
protected $table = 'event_pictures'; |
40
|
|
|
|
41
|
|
|
public $timestamps = true; |
42
|
|
|
|
43
|
|
|
protected $fillable = [ |
44
|
|
|
'user_id', |
45
|
|
|
'event_id', |
46
|
|
|
'title', |
47
|
|
|
'desc', |
48
|
|
|
'filename', |
49
|
|
|
]; |
50
|
|
|
|
51
|
|
|
protected $guarded = []; |
52
|
|
|
|
53
|
|
|
public function user() |
54
|
|
|
{ |
55
|
|
|
return $this->hasOne('App\Models\User', 'id', 'user_id'); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function event() |
59
|
|
|
{ |
60
|
|
|
return $this->hasOne('App\Models\Event', 'id', 'event_id'); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|
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.