Files
einundzwanzig-portal/app/Http/Livewire/BookCase/BookCaseTable.php
Shift 5776b01d15 Apply Laravel coding style
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions.

You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root.

For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
2023-02-19 18:05:16 +01:00

49 lines
1.7 KiB
PHP

<?php
namespace App\Http\Livewire\BookCase;
use App\Models\BookCase;
use App\Models\Country;
use Livewire\Component;
use RalphJSmit\Laravel\SEO\Support\SEOData;
class BookCaseTable extends Component
{
public ?Country $country = null;
public string $c = 'de';
public array $bookcases = [];
protected $queryString = ['bookcases'];
public function render()
{
return view('livewire.book-case.book-case-table', [
'markers' => ! isset($this->table['filters']['byids']) ? []
: BookCase::query()
->whereIn('id', str($this->table['filters']['byids'] ?? '')->explode(','))
->get()
->map(fn ($b) => [
'title' => $b->title,
'lat' => $b->latitude,
'lng' => $b->longitude,
'url' => route('bookCases.comment.bookcase', ['country' => $this->country, 'bookCase' => $b]),
'icon' => asset('img/btc-logo-6219386_1280.png'),
'icon_size' => [42, 42],
])
->toArray(),
'bookCases' => BookCase::query()->active()->get(),
'countries' => Country::query()
->select(['code', 'name'])
->get(),
])->layout('layouts.app', [
'SEOData' => new SEOData(
title: __('Bookcases'),
description: __('Search out a public bookcase'),
image: asset('img/screenshot.png')
),
]);
}
}