fix+add: seats + seat-chooser
This commit is contained in:
parent
2c6745e812
commit
b0cc5b5278
31 changed files with 808 additions and 115 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
|
@ -45,4 +46,29 @@ class Showing extends Model
|
|||
return $this->where('showing_start', '>=', now())->get();
|
||||
}
|
||||
|
||||
public function end_time() {
|
||||
$date = new Carbon($this->showing_start);
|
||||
$date->addMinutes($this->movie->movie_length);
|
||||
return $date;
|
||||
}
|
||||
|
||||
public function tickets()
|
||||
{
|
||||
return $this->hasMany(Ticket::class, 'showing_id', 'showing_id');
|
||||
}
|
||||
|
||||
public function tickets_available() {
|
||||
$tickets = $this->room->seats()->count();
|
||||
$tickets_sold = $this->tickets()->count();
|
||||
return $tickets - $tickets_sold;
|
||||
}
|
||||
|
||||
public function find($id)
|
||||
{
|
||||
return Showing::where('showing_id', $id)->first();
|
||||
}
|
||||
|
||||
public function seatMatrix() {
|
||||
return $this->room->seatMatrix($this->showing_id);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue