Last change
on this file since dfae77e was dfae77e, checked in by Igor Danilovski <igor_danilovski@…>, 2 years ago |
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | namespace App\Models;
|
---|
4 |
|
---|
5 | use Illuminate\Database\Eloquent\Factories\HasFactory;
|
---|
6 | use Illuminate\Database\Eloquent\Model;
|
---|
7 | use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
---|
8 | use Illuminate\Database\Eloquent\Relations\HasMany;
|
---|
9 | use Illuminate\Database\Eloquent\Relations\HasOne;
|
---|
10 |
|
---|
11 | class Offer extends Model
|
---|
12 | {
|
---|
13 | use HasFactory;
|
---|
14 |
|
---|
15 | protected $table = 'offers';
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * The attributes that are mass assignable.
|
---|
19 | *
|
---|
20 | * @var array<int, string>
|
---|
21 | */
|
---|
22 | protected $fillable = [
|
---|
23 | 'slug',
|
---|
24 | 'payment_type',
|
---|
25 | 'status',
|
---|
26 | 'artist_id',
|
---|
27 | 'event_id',
|
---|
28 | ];
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * The attributes that are not mass assignable.
|
---|
32 | * @var string[]
|
---|
33 | */
|
---|
34 | protected $guarded = [
|
---|
35 | 'price',
|
---|
36 | ];
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * The attributes that should be cast.
|
---|
40 | *
|
---|
41 | * @var array<string, string>
|
---|
42 | */
|
---|
43 | protected $casts = [
|
---|
44 | 'completed_at' => 'datetime',
|
---|
45 | ];
|
---|
46 |
|
---|
47 | public function artist(): BelongsTo
|
---|
48 | {
|
---|
49 | return $this->belongsTo(Artist::class, 'artist_id');
|
---|
50 | }
|
---|
51 |
|
---|
52 | public function event(): BelongsTo
|
---|
53 | {
|
---|
54 | return $this->belongsTo(Event::class);
|
---|
55 | }
|
---|
56 |
|
---|
57 | public function comments(): HasMany
|
---|
58 | {
|
---|
59 | return $this->hasMany(OfferComment::class)->orderBy('created_at', 'desc');
|
---|
60 | }
|
---|
61 |
|
---|
62 | public function transactions(): HasMany
|
---|
63 | {
|
---|
64 | return $this->hasMany(Transaction::class);
|
---|
65 | }
|
---|
66 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.