mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
zoom in country
This commit is contained in:
@@ -5,6 +5,8 @@ namespace App\Models;
|
||||
use Akuechler\Geoly;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Spatie\Sluggable\HasSlug;
|
||||
use Spatie\Sluggable\SlugOptions;
|
||||
|
||||
@@ -32,7 +34,9 @@ class City extends Model
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
$model->created_by = auth()->id();
|
||||
if (!$model->created_by) {
|
||||
$model->created_by = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -47,17 +51,17 @@ class City extends Model
|
||||
->usingLanguage('de');
|
||||
}
|
||||
|
||||
public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function createdBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
|
||||
public function country(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function country(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Country::class);
|
||||
}
|
||||
|
||||
public function venues(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
public function venues(): HasMany
|
||||
{
|
||||
return $this->hasMany(Venue::class);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user