created_by corrected

This commit is contained in:
Benjamin Takats
2022-12-15 21:51:15 +01:00
parent ce0c12ac9e
commit cf31b4d5ea
16 changed files with 136 additions and 17 deletions

View File

@@ -9,10 +9,25 @@ use Livewire\Component;
class BookCaseTable extends Component class BookCaseTable extends Component
{ {
public string $c = 'de'; public string $c = 'de';
public array $table = [];
protected $queryString = ['table'];
public function render() public function render()
{ {
return view('livewire.book-case.book-case-table', [ 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(), 'bookCases' => BookCase::get(),
'countries' => Country::query() 'countries' => Country::query()
->select(['code', 'name']) ->select(['code', 'name'])

View File

@@ -16,14 +16,12 @@ class BitcoinEvent extends Model implements HasMedia
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
@@ -33,6 +31,13 @@ class BitcoinEvent extends Model implements HasMedia
'to' => 'datetime', 'to' => 'datetime',
]; ];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function registerMediaConversions(Media $media = null): void public function registerMediaConversions(Media $media = null): void
{ {
$this $this

View File

@@ -37,6 +37,13 @@ class BookCase extends Model implements HasMedia
'deactivated' => 'boolean', 'deactivated' => 'boolean',
]; ];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function registerMediaConversions(Media $media = null): void public function registerMediaConversions(Media $media = null): void
{ {
$this $this

View File

@@ -29,6 +29,13 @@ class City extends Model
'country_id' => 'integer', 'country_id' => 'integer',
]; ];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
/** /**
* Get the options for generating the slug. * Get the options for generating the slug.
*/ */

View File

@@ -33,6 +33,13 @@ class Course extends Model implements HasMedia
'lecturer_id' => 'integer', 'lecturer_id' => 'integer',
]; ];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function registerMediaConversions(Media $media = null): void public function registerMediaConversions(Media $media = null): void
{ {
$this $this

View File

@@ -29,6 +29,13 @@ class CourseEvent extends Model
'to' => 'datetime', 'to' => 'datetime',
]; ];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{ {
return $this->belongsTo(User::class, 'created_by'); return $this->belongsTo(User::class, 'created_by');

View File

@@ -28,6 +28,13 @@ class Episode extends Model
'data' => 'array', 'data' => 'array',
]; ];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{ {
return $this->belongsTo(User::class, 'created_by'); return $this->belongsTo(User::class, 'created_by');

View File

@@ -32,6 +32,13 @@ class Lecturer extends Model implements HasMedia
'active' => 'boolean', 'active' => 'boolean',
]; ];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function registerMediaConversions(Media $media = null): void public function registerMediaConversions(Media $media = null): void
{ {
$this $this

View File

@@ -26,6 +26,13 @@ class Library extends Model
'language_codes' => 'array', 'language_codes' => 'array',
]; ];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{ {
return $this->belongsTo(User::class, 'created_by'); return $this->belongsTo(User::class, 'created_by');

View File

@@ -37,6 +37,13 @@ class LibraryItem extends Model implements HasMedia, Sortable
'library_id' => 'integer', 'library_id' => 'integer',
]; ];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function registerMediaConversions(Media $media = null): void public function registerMediaConversions(Media $media = null): void
{ {
$this $this

View File

@@ -30,6 +30,13 @@ class Meetup extends Model implements HasMedia
'city_id' => 'integer', 'city_id' => 'integer',
]; ];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function registerMediaConversions(Media $media = null): void public function registerMediaConversions(Media $media = null): void
{ {
$this $this

View File

@@ -27,6 +27,13 @@ class MeetupEvent extends Model
'start' => 'datetime', 'start' => 'datetime',
]; ];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{ {
return $this->belongsTo(User::class, 'created_by'); return $this->belongsTo(User::class, 'created_by');

View File

@@ -25,6 +25,13 @@ class Podcast extends Model
'data' => 'array', 'data' => 'array',
]; ];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{ {
return $this->belongsTo(User::class, 'created_by'); return $this->belongsTo(User::class, 'created_by');

View File

@@ -34,6 +34,13 @@ class Venue extends Model implements HasMedia
'city_id' => 'integer', 'city_id' => 'integer',
]; ];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function registerMediaConversions(Media $media = null): void public function registerMediaConversions(Media $media = null): void
{ {
$this $this

View File

@@ -4,6 +4,33 @@
{{-- MAIN --}} {{-- MAIN --}}
<section class="w-full mb-12"> <section class="w-full mb-12">
<div class="max-w-screen-2xl mx-auto px-2 sm:px-10" id="table"> <div class="max-w-screen-2xl mx-auto px-2 sm:px-10" id="table">
<div class="flex items-start">
<div class="w-1/2">
<h1 class="mb-6 text-5xl font-extrabold leading-none max-w-5xl mx-auto tracking-normal text-gray-200 sm:text-6xl md:text-6xl lg:text-7xl md:tracking-tight">
Bitcoin <span
class="w-full text-transparent bg-clip-text bg-gradient-to-r from-amber-400 via-amber-500 to-amber-200 lg:inline">Bücher-Schränke</span>
für deine<br class="lg:block hidden"> Reise in den Kaninchenbau.
</h1>
<p class="px-0 mb-6 text-lg text-gray-600 md:text-xl lg:px-24"> Suche einen öffentlichen
Bücher-Schrank aus. </p>
</div>
<div class="w-1/2">
<div class="rounded" wire:ignore>
@if($markers[0] ?? false)
<div>
@map([
'lat' => $markers[0]['lat'],
'lng' => $markers[0]['lng'],
'zoom' => 12,
'markers' => $markers
])
</div>
@endif
</div>
</div>
</div>
<livewire:tables.book-case-table :country="$c"/> <livewire:tables.book-case-table :country="$c"/>
</div> </div>
</section> </section>

View File

@@ -139,18 +139,6 @@
</div> </div>
@endif @endif
@if(str(request()->route()->getName())->contains('bookCases.'))
<div>
<h1 class="mb-6 text-5xl font-extrabold leading-none max-w-5xl mx-auto tracking-normal text-gray-200 sm:text-6xl md:text-6xl lg:text-7xl md:tracking-tight">
Bitcoin <span
class="w-full text-transparent bg-clip-text bg-gradient-to-r from-amber-400 via-amber-500 to-amber-200 lg:inline">Bücher-Schränke</span>
für deine<br class="lg:block hidden"> Reise in den Kaninchenbau.
</h1>
<p class="px-0 mb-6 text-lg text-gray-600 md:text-xl lg:px-24"> Suche einen öffentlichen
Bücher-Schrank aus. </p>
</div>
@endif
</div> </div>
</div> </div>
</section> </section>