source: app/Models/Event.php@ dfae77e

Last change on this file since dfae77e was dfae77e, checked in by Igor Danilovski <igor_danilovski@…>, 2 years ago
  • Initial commit;
  • Property mode set to 100644
File size: 1.2 KB
Line 
1<?php
2
3namespace App\Models;
4
5use Illuminate\Database\Eloquent\Factories\HasFactory;
6use Illuminate\Database\Eloquent\Model;
7use Illuminate\Database\Eloquent\Relations\BelongsTo;
8use Illuminate\Database\Eloquent\Relations\HasMany;
9
10class Event extends Model
11{
12 use HasFactory;
13
14 protected $table = 'events';
15
16 /**
17 * The attributes that are mass assignable.
18 *
19 * @var array<int, string>
20 */
21 protected $fillable = [
22 'title',
23 'slug',
24 'city',
25 'country',
26 'description',
27 'event_type_id',
28 'organizer_id',
29 ];
30
31 /**
32 * The attributes that should be cast.
33 *
34 * @var array<string, string>
35 */
36 protected $casts = [
37 'event_date' => 'date',
38 ];
39
40 protected $dates = [
41 'event_date',
42 'start_time',
43 'end_time'
44 ];
45
46 public function event_type(): BelongsTo
47 {
48 return $this->belongsTo(EventType::class);
49 }
50
51 public function organizer(): BelongsTo
52 {
53 return $this->belongsTo(Organizer::class, 'organizer_id', 'user_id');
54 }
55
56 public function offers(): HasMany
57 {
58 return $this->hasMany(Offer::class);
59 }
60}
Note: See TracBrowser for help on using the repository browser.