mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
bookCases added
This commit is contained in:
22
app/Http/Livewire/Frontend/SearchBookCase.php
Normal file
22
app/Http/Livewire/Frontend/SearchBookCase.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Frontend;
|
||||
|
||||
use App\Models\BookCase;
|
||||
use App\Models\Country;
|
||||
use Livewire\Component;
|
||||
|
||||
class SearchBookCase extends Component
|
||||
{
|
||||
public string $c = 'de';
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.frontend.search-book-case', [
|
||||
'bookCases' => BookCase::get(),
|
||||
'countries' => Country::query()
|
||||
->select(['code', 'name'])
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
55
app/Http/Livewire/Tables/BookCaseTable.php
Normal file
55
app/Http/Livewire/Tables/BookCaseTable.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Tables;
|
||||
|
||||
use App\Models\BookCase;
|
||||
use Rappasoft\LaravelLivewireTables\DataTableComponent;
|
||||
use Rappasoft\LaravelLivewireTables\Views\Column;
|
||||
use Rappasoft\LaravelLivewireTables\Views\Columns\BooleanColumn;
|
||||
|
||||
class BookCaseTable extends DataTableComponent
|
||||
{
|
||||
protected $model = BookCase::class;
|
||||
|
||||
public function configure(): void
|
||||
{
|
||||
$this->setPrimaryKey('id')
|
||||
->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',
|
||||
'default' => false,
|
||||
];
|
||||
})
|
||||
->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) {
|
||||
return [
|
||||
'class' => 'px-6 py-4 text-sm font-medium dark:text-white',
|
||||
'default' => false,
|
||||
];
|
||||
})
|
||||
->setColumnSelectStatus(false)
|
||||
->setPerPage(50);
|
||||
}
|
||||
|
||||
public function columns(): array
|
||||
{
|
||||
return [
|
||||
Column::make("Name", "title")
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Column::make("Adresse", "address")
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Column::make("Link")
|
||||
->label(
|
||||
fn(
|
||||
$row,
|
||||
Column $column
|
||||
) => '<a class="underline text-amber-500" href="'.$row->homepage.'">Link</a>'
|
||||
)
|
||||
->html(),
|
||||
BooleanColumn::make('Oranged-Pilled', 'deactivated')
|
||||
->sortable(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user