mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-13 06:56:48 +00:00
meetups added
This commit is contained in:
@@ -52,6 +52,6 @@ class City extends Model
|
||||
|
||||
function events()
|
||||
{
|
||||
return $this->hasManyThrough(Event::class, Venue::class);
|
||||
return $this->hasManyThrough(CourseEvent::class, Venue::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,6 @@ class Course extends Model implements HasMedia
|
||||
|
||||
public function events(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(Event::class);
|
||||
return $this->hasMany(CourseEvent::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Event extends Model
|
||||
class CourseEvent extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
33
app/Models/Meetup.php
Normal file
33
app/Models/Meetup.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Meetup extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'city_id' => 'integer',
|
||||
];
|
||||
|
||||
public function city(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(City::class);
|
||||
}
|
||||
}
|
||||
34
app/Models/MeetupEvent.php
Normal file
34
app/Models/MeetupEvent.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MeetupEvent extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'meetup_id' => 'integer',
|
||||
'start' => 'datetime',
|
||||
];
|
||||
|
||||
public function meetup(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Meetup::class);
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ class Registration extends Model
|
||||
|
||||
public function event(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Event::class);
|
||||
return $this->belongsTo(CourseEvent::class);
|
||||
}
|
||||
|
||||
public function participant(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
|
||||
@@ -75,11 +75,11 @@ class Venue extends Model implements HasMedia
|
||||
|
||||
public function courses()
|
||||
{
|
||||
return $this->hasManyDeepFromRelations($this->events(), (new Event())->course());
|
||||
return $this->hasManyDeepFromRelations($this->events(), (new CourseEvent())->course());
|
||||
}
|
||||
|
||||
public function events(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(Event::class);
|
||||
return $this->hasMany(CourseEvent::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user