mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
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).
This commit is contained in:
committed by
HolgerHatGarKeineNode
parent
a15ca4a2bc
commit
5776b01d15
@@ -14,6 +14,7 @@ class CityTable extends DataTableComponent
|
||||
use Actions;
|
||||
|
||||
public string $country;
|
||||
|
||||
public string $type;
|
||||
|
||||
public string $tableName = 'cities';
|
||||
@@ -24,44 +25,44 @@ class CityTable extends DataTableComponent
|
||||
->setAdditionalSelects(['id'])
|
||||
->setThAttributes(function (Column $column) {
|
||||
return [
|
||||
'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400',
|
||||
'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400',
|
||||
'default' => false,
|
||||
];
|
||||
})
|
||||
->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) {
|
||||
return [
|
||||
'class' => 'px-6 py-4 text-sm font-medium dark:text-white',
|
||||
'class' => 'px-6 py-4 text-sm font-medium dark:text-white',
|
||||
'default' => false,
|
||||
];
|
||||
})
|
||||
->setColumnSelectStatus(false)
|
||||
->setPerPage(10)
|
||||
->setConfigurableAreas([
|
||||
'toolbar-left-end' => [
|
||||
'columns.cities.areas.toolbar-left-end', [
|
||||
'country' => $this->country,
|
||||
],
|
||||
],
|
||||
]);
|
||||
'toolbar-left-end' => [
|
||||
'columns.cities.areas.toolbar-left-end', [
|
||||
'country' => $this->country,
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function columns(): array
|
||||
{
|
||||
$columns = collect([
|
||||
Column::make("Stadt Name", "name")
|
||||
Column::make('Stadt Name', 'name')
|
||||
->sortable()
|
||||
->searchable(fn($builder, $term) => $builder->where('cities.name', 'ilike', '%'.$term.'%')),
|
||||
->searchable(fn ($builder, $term) => $builder->where('cities.name', 'ilike', '%'.$term.'%')),
|
||||
]);
|
||||
if ($this->type === 'school') {
|
||||
$columns = $columns->merge([
|
||||
Column::make('Veranstaltungs-Orte')
|
||||
->label(
|
||||
fn($row, Column $column) => $row->venues_count
|
||||
fn ($row, Column $column) => $row->venues_count
|
||||
)
|
||||
->collapseOnMobile(),
|
||||
Column::make('Termine')
|
||||
->label(
|
||||
fn($row, Column $column) => $row->course_events_count
|
||||
fn ($row, Column $column) => $row->course_events_count
|
||||
)
|
||||
->collapseOnMobile(),
|
||||
]);
|
||||
@@ -70,7 +71,7 @@ class CityTable extends DataTableComponent
|
||||
return $columns->merge([
|
||||
Column::make('')
|
||||
->label(
|
||||
fn($row, Column $column) => view('columns.cities.action')
|
||||
fn ($row, Column $column) => view('columns.cities.action')
|
||||
->withRow($row)
|
||||
->withType($this->type)
|
||||
),
|
||||
@@ -85,7 +86,7 @@ class CityTable extends DataTableComponent
|
||||
'venues',
|
||||
'courseEvents',
|
||||
])
|
||||
->whereHas('country', fn($query) => $query->where('code', $this->country))
|
||||
->whereHas('country', fn ($query) => $query->where('code', $this->country))
|
||||
->orderByDesc('course_events_count')
|
||||
->orderBy('cities.id');
|
||||
}
|
||||
@@ -96,16 +97,17 @@ class CityTable extends DataTableComponent
|
||||
->find($id);
|
||||
$query = City::radius($city->latitude, $city->longitude, 100)
|
||||
->where('id', '!=', $id);
|
||||
|
||||
return to_route('school.table.event', [
|
||||
'#table',
|
||||
'country' => $this->country,
|
||||
'course_events' => [
|
||||
'course_events' => [
|
||||
'filters' => [
|
||||
'stadt' => $query->pluck('name')
|
||||
->push($city->name)
|
||||
->implode(',')
|
||||
->implode(','),
|
||||
],
|
||||
]
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -118,17 +120,18 @@ class CityTable extends DataTableComponent
|
||||
if ($ids->isEmpty()) {
|
||||
$this->notification()
|
||||
->error(__('No bookcases found in the radius of 5km'));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return to_route('bookCases.table.bookcases', [
|
||||
'#table',
|
||||
'country' => $this->country,
|
||||
'bookcases' => [
|
||||
'bookcases' => [
|
||||
'filters' => [
|
||||
'byids' => $ids->implode(',')
|
||||
'byids' => $ids->implode(','),
|
||||
],
|
||||
]
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user