@@ 7-27 (lines=21) @@ | ||
4 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
|
5 | use Illuminate\Database\Eloquent\Relations\BelongsToMany; |
|
6 | ||
7 | class Book extends CachedModel |
|
8 | { |
|
9 | protected $dates = [ |
|
10 | 'published_at', |
|
11 | ]; |
|
12 | protected $fillable = [ |
|
13 | 'description', |
|
14 | 'published_at', |
|
15 | 'title', |
|
16 | ]; |
|
17 | ||
18 | public function author() : BelongsTo |
|
19 | { |
|
20 | return $this->belongsTo(Author::class); |
|
21 | } |
|
22 | ||
23 | public function stores() : BelongsToMany |
|
24 | { |
|
25 | return $this->belongsToMany(Store::class); |
|
26 | } |
|
27 | } |
|
28 |
@@ 7-28 (lines=22) @@ | ||
4 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
|
5 | use Illuminate\Database\Eloquent\Relations\BelongsToMany; |
|
6 | ||
7 | class UncachedBook extends CachedModel |
|
8 | { |
|
9 | protected $dates = [ |
|
10 | 'published_at', |
|
11 | ]; |
|
12 | protected $fillable = [ |
|
13 | 'description', |
|
14 | 'published_at', |
|
15 | 'title', |
|
16 | ]; |
|
17 | protected $table = 'books'; |
|
18 | ||
19 | public function author() : BelongsTo |
|
20 | { |
|
21 | return $this->belongsTo(UncachedAuthor::class); |
|
22 | } |
|
23 | ||
24 | public function stores() : BelongsToMany |
|
25 | { |
|
26 | return $this->belongsToMany(UncachedStore::class); |
|
27 | } |
|
28 | } |
|
29 |