Files
einundzwanzig-portal/app/Http/Livewire/Tables/MeetupForBtcMapTable.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

54 lines
1.4 KiB
PHP

<?php
namespace App\Http\Livewire\Tables;
use App\Models\Meetup;
use Illuminate\Database\Eloquent\Builder;
use Rappasoft\LaravelLivewireTables\DataTableComponent;
use Rappasoft\LaravelLivewireTables\Views\Column;
class MeetupForBtcMapTable extends DataTableComponent
{
public function configure(): void
{
$this
->setPrimaryKey('id')
->setAdditionalSelects([
'osm_relation',
'simplified_geojson',
'population',
'population_date',
'city_id',
])
->setPerPageAccepted([
100000,
])
->setPerPage(100000);
}
public function columns(): array
{
return [
Column::make('Id', 'id')
->sortable(),
Column::make('Name', 'name')
->sortable(),
Column::make('City', 'city.name')
->sortable(),
Column::make('Country', 'city.country.name')
->sortable(),
Column::make('Actions')
->label(fn ($row, Column $column) => view('columns.meetups.osm-actions', ['row' => $row])),
];
}
public function builder(): Builder
{
return Meetup::query()
->with([
'city.country',
])
->orderBy('cities.population');
}
}