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
@@ -3,9 +3,7 @@
|
||||
namespace App\Http\Livewire\Tables;
|
||||
|
||||
use App\Models\BookCase;
|
||||
use App\Models\OrangePill;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Livewire\WithFileUploads;
|
||||
use Rappasoft\LaravelLivewireTables\DataTableComponent;
|
||||
use Rappasoft\LaravelLivewireTables\Views\Column;
|
||||
use Rappasoft\LaravelLivewireTables\Views\Filters\TextFilter;
|
||||
@@ -16,6 +14,7 @@ class BookCaseTable extends DataTableComponent
|
||||
use Actions;
|
||||
|
||||
public string $country;
|
||||
|
||||
public string $tableName = 'bookcases';
|
||||
|
||||
public function configure(): void
|
||||
@@ -24,14 +23,13 @@ class BookCaseTable extends DataTableComponent
|
||||
->setAdditionalSelects(['id', 'homepage'])
|
||||
->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,
|
||||
];
|
||||
})
|
||||
@@ -39,7 +37,6 @@ class BookCaseTable extends DataTableComponent
|
||||
->setPerPage(10);
|
||||
}
|
||||
|
||||
|
||||
public function filters(): array
|
||||
{
|
||||
return [
|
||||
@@ -54,27 +51,27 @@ class BookCaseTable extends DataTableComponent
|
||||
public function columns(): array
|
||||
{
|
||||
return [
|
||||
Column::make("Name", "title")
|
||||
Column::make('Name', 'title')
|
||||
->sortable()
|
||||
->searchable(
|
||||
function (Builder $query, $searchTerm) {
|
||||
$query->where('title', 'ilike', '%'.$searchTerm.'%');
|
||||
}
|
||||
),
|
||||
Column::make("Adresse", "address")
|
||||
Column::make('Adresse', 'address')
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Column::make("Bitcoin-Bücher")
|
||||
Column::make('Bitcoin-Bücher')
|
||||
->label(
|
||||
fn(
|
||||
fn (
|
||||
$row,
|
||||
Column $column
|
||||
) => $row->orangePills->sum('amount')
|
||||
)
|
||||
->collapseOnMobile(),
|
||||
Column::make("Letzter Input")
|
||||
Column::make('Letzter Input')
|
||||
->label(
|
||||
fn(
|
||||
fn (
|
||||
$row,
|
||||
Column $column
|
||||
) => $row->orangePills()
|
||||
@@ -82,9 +79,9 @@ class BookCaseTable extends DataTableComponent
|
||||
->first()?->date->asDate()
|
||||
)
|
||||
->collapseOnMobile(),
|
||||
Column::make("Link")
|
||||
Column::make('Link')
|
||||
->label(
|
||||
fn(
|
||||
fn (
|
||||
$row,
|
||||
Column $column
|
||||
) => $row->homepage ? '<a target="_blank" class="underline text-amber-500" href="'.$this->url_to_absolute($row->homepage).'">Link</a>' : null
|
||||
@@ -92,7 +89,7 @@ class BookCaseTable extends DataTableComponent
|
||||
->html()
|
||||
->collapseOnMobile(),
|
||||
Column::make('Orange-Pilled', 'orange_pilled')
|
||||
->label(fn($row, Column $column) => view('columns.book_cases.oranged-pilled')
|
||||
->label(fn ($row, Column $column) => view('columns.book_cases.oranged-pilled')
|
||||
->withRow($row)
|
||||
->withCountry($this->country))
|
||||
->collapseOnMobile(),
|
||||
@@ -104,7 +101,7 @@ class BookCaseTable extends DataTableComponent
|
||||
if (str($url)->contains('http')) {
|
||||
return $url;
|
||||
}
|
||||
if (!str($url)->contains('http')) {
|
||||
if (! str($url)->contains('http')) {
|
||||
return str($url)->prepend('https://');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user