3
0
Fork 0

Added Shows, ActionFoto's and Attraction Status

This commit is contained in:
BuildTools 2020-02-27 00:42:36 +01:00
parent b105bd7db7
commit ad320963fc
30 changed files with 1190 additions and 503 deletions

View file

@ -51,6 +51,37 @@ class User extends Authenticatable implements MustVerifyEmail
return $username;
}
private $shows = null;
public function hasShows() {
if($this->shows !== null)
return true;
$shows = Show::join('seats', 'seats.show_id', '=', 'shows.id')
->select([
'shows.title', 'shows.description', 'shows.image', 'seats.*'
])
->where('seats.uuid', '=', $this->uuid)
->where('seats.date', '>', 'CURRENT_TIMESTAMP()')
->get()->all();
$this->shows = $shows;
return !empty($shows);
}
public function getShows() {
if($this->shows !== null)
return $this->shows;
$shows = Show::join('seats', 'seats.show_id', '=', 'shows.id')
->select([
'shows.title', 'shows.description', 'shows.image', 'seats.*'
])
->where('seats.uuid', '=', $this->uuid)
->where('seats.date', '>', 'CURRENT_TIMESTAMP()')
->get()->all();
$this->shows = $shows;
return $shows;
}
public function photo() {
return 'https://crafatar.com/avatars/'.$this->uuid.'?overlay';
}