diff --git a/app/Http/Livewire/BookCase/BookCaseTable.php b/app/Http/Livewire/BookCase/BookCaseTable.php index b1ef0e5e..953d318a 100644 --- a/app/Http/Livewire/BookCase/BookCaseTable.php +++ b/app/Http/Livewire/BookCase/BookCaseTable.php @@ -9,10 +9,25 @@ use Livewire\Component; class BookCaseTable extends Component { public string $c = 'de'; + public array $table = []; + + protected $queryString = ['table']; public function render() { return view('livewire.book-case.book-case-table', [ + 'markers' => BookCase::when($this->table['filters']['byids'] ?? false, + fn($query) => $query->whereIn('id', str($this->table['filters']['byids'] ?? '')->explode(','))) + ->get() + ->map(fn($b) => [ + 'title' => $b->title, + 'lat' => $b->latitude, + 'lng' => $b->longitude, + 'url' => 'https://gonoware.com', + 'icon' => asset('img/btc-logo-6219386_1280.png'), + 'icon_size' => [42, 42], + ]) + ->toArray(), 'bookCases' => BookCase::get(), 'countries' => Country::query() ->select(['code', 'name']) diff --git a/app/Models/BitcoinEvent.php b/app/Models/BitcoinEvent.php index a50ca933..4817783c 100644 --- a/app/Models/BitcoinEvent.php +++ b/app/Models/BitcoinEvent.php @@ -16,23 +16,28 @@ class BitcoinEvent extends Model implements HasMedia /** * 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', + 'id' => 'integer', 'venue_id' => 'integer', - 'from' => 'datetime', - 'to' => 'datetime', + 'from' => 'datetime', + 'to' => 'datetime', ]; + protected static function booted() + { + static::creating(function ($model) { + $model->created_by = auth()->id(); + }); + } + public function registerMediaConversions(Media $media = null): void { $this diff --git a/app/Models/BookCase.php b/app/Models/BookCase.php index f7d59868..acf04f21 100644 --- a/app/Models/BookCase.php +++ b/app/Models/BookCase.php @@ -37,6 +37,13 @@ class BookCase extends Model implements HasMedia 'deactivated' => 'boolean', ]; + protected static function booted() + { + static::creating(function ($model) { + $model->created_by = auth()->id(); + }); + } + public function registerMediaConversions(Media $media = null): void { $this diff --git a/app/Models/City.php b/app/Models/City.php index b4c8c321..fe9909f5 100644 --- a/app/Models/City.php +++ b/app/Models/City.php @@ -29,6 +29,13 @@ class City extends Model 'country_id' => 'integer', ]; + protected static function booted() + { + static::creating(function ($model) { + $model->created_by = auth()->id(); + }); + } + /** * Get the options for generating the slug. */ diff --git a/app/Models/Course.php b/app/Models/Course.php index fe4a41ab..f3e4b922 100644 --- a/app/Models/Course.php +++ b/app/Models/Course.php @@ -33,6 +33,13 @@ class Course extends Model implements HasMedia 'lecturer_id' => 'integer', ]; + protected static function booted() + { + static::creating(function ($model) { + $model->created_by = auth()->id(); + }); + } + public function registerMediaConversions(Media $media = null): void { $this diff --git a/app/Models/CourseEvent.php b/app/Models/CourseEvent.php index f97bf297..9e7bb20d 100644 --- a/app/Models/CourseEvent.php +++ b/app/Models/CourseEvent.php @@ -29,6 +29,13 @@ class CourseEvent extends Model 'to' => 'datetime', ]; + protected static function booted() + { + static::creating(function ($model) { + $model->created_by = auth()->id(); + }); + } + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class, 'created_by'); diff --git a/app/Models/Episode.php b/app/Models/Episode.php index c78667bd..1169ecba 100644 --- a/app/Models/Episode.php +++ b/app/Models/Episode.php @@ -28,6 +28,13 @@ class Episode extends Model 'data' => 'array', ]; + protected static function booted() + { + static::creating(function ($model) { + $model->created_by = auth()->id(); + }); + } + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class, 'created_by'); diff --git a/app/Models/Lecturer.php b/app/Models/Lecturer.php index 3a4cb149..6b088f97 100644 --- a/app/Models/Lecturer.php +++ b/app/Models/Lecturer.php @@ -32,6 +32,13 @@ class Lecturer extends Model implements HasMedia 'active' => 'boolean', ]; + protected static function booted() + { + static::creating(function ($model) { + $model->created_by = auth()->id(); + }); + } + public function registerMediaConversions(Media $media = null): void { $this diff --git a/app/Models/Library.php b/app/Models/Library.php index d20245b0..40353f6a 100644 --- a/app/Models/Library.php +++ b/app/Models/Library.php @@ -26,6 +26,13 @@ class Library extends Model 'language_codes' => 'array', ]; + protected static function booted() + { + static::creating(function ($model) { + $model->created_by = auth()->id(); + }); + } + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class, 'created_by'); diff --git a/app/Models/LibraryItem.php b/app/Models/LibraryItem.php index adb38591..3b7cd8ef 100644 --- a/app/Models/LibraryItem.php +++ b/app/Models/LibraryItem.php @@ -37,6 +37,13 @@ class LibraryItem extends Model implements HasMedia, Sortable 'library_id' => 'integer', ]; + protected static function booted() + { + static::creating(function ($model) { + $model->created_by = auth()->id(); + }); + } + public function registerMediaConversions(Media $media = null): void { $this diff --git a/app/Models/Meetup.php b/app/Models/Meetup.php index 1e17c575..88469b64 100644 --- a/app/Models/Meetup.php +++ b/app/Models/Meetup.php @@ -30,6 +30,13 @@ class Meetup extends Model implements HasMedia 'city_id' => 'integer', ]; + protected static function booted() + { + static::creating(function ($model) { + $model->created_by = auth()->id(); + }); + } + public function registerMediaConversions(Media $media = null): void { $this diff --git a/app/Models/MeetupEvent.php b/app/Models/MeetupEvent.php index 00f4cfa6..a16e8e03 100644 --- a/app/Models/MeetupEvent.php +++ b/app/Models/MeetupEvent.php @@ -27,6 +27,13 @@ class MeetupEvent extends Model 'start' => 'datetime', ]; + protected static function booted() + { + static::creating(function ($model) { + $model->created_by = auth()->id(); + }); + } + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class, 'created_by'); diff --git a/app/Models/Podcast.php b/app/Models/Podcast.php index 979405ff..c674b904 100644 --- a/app/Models/Podcast.php +++ b/app/Models/Podcast.php @@ -25,6 +25,13 @@ class Podcast extends Model 'data' => 'array', ]; + protected static function booted() + { + static::creating(function ($model) { + $model->created_by = auth()->id(); + }); + } + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class, 'created_by'); diff --git a/app/Models/Venue.php b/app/Models/Venue.php index fabec0cf..0ce81088 100644 --- a/app/Models/Venue.php +++ b/app/Models/Venue.php @@ -34,6 +34,13 @@ class Venue extends Model implements HasMedia 'city_id' => 'integer', ]; + protected static function booted() + { + static::creating(function ($model) { + $model->created_by = auth()->id(); + }); + } + public function registerMediaConversions(Media $media = null): void { $this diff --git a/resources/views/livewire/book-case/book-case-table.blade.php b/resources/views/livewire/book-case/book-case-table.blade.php index 4bf8ffc1..3d4e561c 100644 --- a/resources/views/livewire/book-case/book-case-table.blade.php +++ b/resources/views/livewire/book-case/book-case-table.blade.php @@ -4,6 +4,33 @@ {{-- MAIN --}}
+
+
+

+ Bitcoin Bücher-Schränke + für deine Reise in den Kaninchenbau. +

+

Suche einen öffentlichen + Bücher-Schrank aus.

+
+ +
+
+ @if($markers[0] ?? false) +
+ @map([ + 'lat' => $markers[0]['lat'], + 'lng' => $markers[0]['lng'], + 'zoom' => 12, + 'markers' => $markers + ]) +
+ @endif +
+
+
+
diff --git a/resources/views/livewire/frontend/header.blade.php b/resources/views/livewire/frontend/header.blade.php index 32b4349e..fbd5abc3 100644 --- a/resources/views/livewire/frontend/header.blade.php +++ b/resources/views/livewire/frontend/header.blade.php @@ -139,18 +139,6 @@ @endif - @if(str(request()->route()->getName())->contains('bookCases.')) -
-

- Bitcoin Bücher-Schränke - für deine Reise in den Kaninchenbau. -

-

Suche einen öffentlichen - Bücher-Schrank aus.

-
- @endif -