mega-commit: migrations, controllers, models, etc.

This commit is contained in:
Didier Slof 2022-12-08 09:30:07 +01:00
parent 9732135e90
commit 2c6745e812
Signed by: didier
GPG key ID: 01E71F18AA4398E5
70 changed files with 2124 additions and 400 deletions

View file

@ -15,6 +15,7 @@ class Room extends Model
'room_rows',
'room_columns',
'user_id', // who added the room?
'cinema_id',
];
protected $hidden = [
@ -22,10 +23,24 @@ class Room extends Model
'updated_at',
];
public static function find(int $room_id)
{
return self::where('room_id', $room_id)->first();
}
public function showings()
{
return $this->hasMany(Showing::class, 'room_id', 'room_id');
}
public function seats()
{
return $this->hasMany(Seat::class, 'room_id', 'room_id');
}
public function cinema()
{
return $this->belongsTo(Cinema::class, 'cinema_id', 'cinema_id');
}
}