1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Movie |
5
|
|
|
* |
6
|
|
|
* @property integer $id |
7
|
|
|
* @property string $name |
8
|
|
|
* @property string $boxmojo_id |
9
|
|
|
* @property string $boxoffice_id |
10
|
|
|
* @property \Carbon\Carbon $release |
11
|
|
|
* @property integer $latest_earnings_id |
12
|
|
|
* @property \Carbon\Carbon $created_at |
13
|
|
|
* @property \Carbon\Carbon $updated_at |
14
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\MovieEarning[] $earnings |
15
|
|
|
* @property-read \MovieEarning $latestEarnings |
16
|
|
|
* @method static \Illuminate\Database\Query\Builder|\Movie whereId($value) |
17
|
|
|
* @method static \Illuminate\Database\Query\Builder|\Movie whereName($value) |
18
|
|
|
* @method static \Illuminate\Database\Query\Builder|\Movie whereBoxmojoId($value) |
19
|
|
|
* @method static \Illuminate\Database\Query\Builder|\Movie whereRelease($value) |
20
|
|
|
* @method static \Illuminate\Database\Query\Builder|\Movie whereLatestEarningsId($value) |
21
|
|
|
* @method static \Illuminate\Database\Query\Builder|\Movie whereCreatedAt($value) |
22
|
|
|
* @method static \Illuminate\Database\Query\Builder|\Movie whereUpdatedAt($value) |
23
|
|
|
* @method static \Illuminate\Database\Query\Builder|\Movie whereBoxofficeId($value) |
24
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\League[] $leagues |
25
|
|
|
*/ |
26
|
|
|
class Movie extends Eloquent { |
|
|
|
|
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Fields to format as dates |
30
|
|
|
* @var array |
31
|
|
|
*/ |
32
|
|
|
protected $dates = ['release']; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Allow filling of these fields |
36
|
|
|
* @var array |
37
|
|
|
*/ |
38
|
|
|
protected $fillable = ['name', 'boxmojo_id', 'boxoffice_id', 'release']; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* All movie's earnings |
42
|
|
|
* |
43
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany |
44
|
|
|
*/ |
45
|
|
|
public function earnings() { |
46
|
|
|
return $this->hasMany('MovieEarning'); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Movie's latest earnings |
51
|
|
|
* |
52
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
53
|
|
|
*/ |
54
|
|
|
public function latestEarnings() { |
55
|
|
|
return $this->belongsTo('MovieEarning'); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Leagues this movie is used in |
60
|
|
|
* |
61
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
62
|
|
|
*/ |
63
|
|
|
public function leagues() { |
64
|
|
|
return $this->belongsToMany('League', 'league_movies'); |
65
|
|
|
} |
66
|
|
|
} |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.