mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-13 06:56:48 +00:00
bitcoin events added
This commit is contained in:
15
app/Http/Livewire/BitcoinEvent/BitcoinEventTable.php
Normal file
15
app/Http/Livewire/BitcoinEvent/BitcoinEventTable.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\BitcoinEvent;
|
||||
|
||||
use App\Models\Country;
|
||||
use Livewire\Component;
|
||||
|
||||
class BitcoinEventTable extends Component
|
||||
{
|
||||
public Country $country;
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.bitcoin-event.bitcoin-event-table');
|
||||
}
|
||||
}
|
||||
45
app/Http/Livewire/Tables/BitcoinEventTable.php
Normal file
45
app/Http/Livewire/Tables/BitcoinEventTable.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Tables;
|
||||
|
||||
use App\Models\BitcoinEvent;
|
||||
use Rappasoft\LaravelLivewireTables\DataTableComponent;
|
||||
use Rappasoft\LaravelLivewireTables\Views\Column;
|
||||
|
||||
class BitcoinEventTable extends DataTableComponent
|
||||
{
|
||||
public string $country;
|
||||
|
||||
protected $model = BitcoinEvent::class;
|
||||
|
||||
public function configure(): void
|
||||
{
|
||||
$this->setPrimaryKey('id')
|
||||
->setAdditionalSelects(['bitcoin_events.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(__('Venue'), 'venue.name'),
|
||||
Column::make(__('Title'), 'title')
|
||||
->sortable(),
|
||||
Column::make(__('Link'), 'link')
|
||||
->sortable(),
|
||||
];
|
||||
}
|
||||
}
|
||||
35
app/Models/BitcoinEvent.php
Normal file
35
app/Models/BitcoinEvent.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BitcoinEvent extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'venue_id' => 'integer',
|
||||
'from' => 'datetime',
|
||||
'to' => 'datetime',
|
||||
];
|
||||
|
||||
public function venue(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Venue::class);
|
||||
}
|
||||
}
|
||||
112
app/Nova/BitcoinEvent.php
Normal file
112
app/Nova/BitcoinEvent.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova;
|
||||
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
use Laravel\Nova\Fields\DateTime;
|
||||
use Laravel\Nova\Fields\BelongsTo;
|
||||
|
||||
class BitcoinEvent extends Resource
|
||||
{
|
||||
/**
|
||||
* The model the resource corresponds to.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $model = \App\Models\BitcoinEvent::class;
|
||||
|
||||
/**
|
||||
* The single value that should be used to represent the resource when being displayed.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $title = 'title';
|
||||
|
||||
/**
|
||||
* The columns that should be searched.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $search = [
|
||||
'id',
|
||||
'title',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function fields(Request $request)
|
||||
{
|
||||
return [
|
||||
ID::make()->sortable(),
|
||||
|
||||
DateTime::make('From')
|
||||
->rules('required'),
|
||||
|
||||
DateTime::make('To')
|
||||
->rules('required'),
|
||||
|
||||
Text::make('Title')
|
||||
->rules('required', 'string'),
|
||||
|
||||
Text::make('Description')
|
||||
->rules('required', 'string')->hideFromIndex(),
|
||||
|
||||
Text::make('Link')
|
||||
->rules('required', 'string'),
|
||||
|
||||
BelongsTo::make('Venue'),
|
||||
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cards available for the request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function cards(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filters available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function filters(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the lenses available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function lenses(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actions available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function actions(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Nova\BitcoinEvent;
|
||||
use App\Nova\BookCase;
|
||||
use App\Nova\Category;
|
||||
use App\Nova\City;
|
||||
@@ -54,6 +55,12 @@ class NovaServiceProvider extends NovaApplicationServiceProvider
|
||||
->icon('calendar')
|
||||
->collapsable(),
|
||||
|
||||
MenuSection::make('Events', [
|
||||
MenuItem::resource(BitcoinEvent::class),
|
||||
])
|
||||
->icon('star')
|
||||
->collapsable(),
|
||||
|
||||
MenuSection::make('Schule', [
|
||||
MenuItem::resource(City::class),
|
||||
MenuItem::resource(Venue::class),
|
||||
|
||||
Reference in New Issue
Block a user