bitcoin events added

This commit is contained in:
Benjamin Takats
2022-12-12 18:32:50 +01:00
parent 2d3c63457a
commit 06fe25d195
15 changed files with 357 additions and 15 deletions

View File

@@ -1,3 +1,8 @@
created:
- database/factories/BitcoinEventFactory.php
- database/migrations/2022_12_12_171115_create_bitcoin_events_table.php
- app/Models/BitcoinEvent.php
- app/Nova/BitcoinEvent.php
models: models:
BookCase: { title: string, latitude: 'float:10', longitude: 'float:10', address: 'text nullable', type: string, open: 'string nullable', comment: 'text nullable', contact: 'text nullable', bcz: 'text nullable', digital: boolean, icontype: string, deactivated: boolean, deactreason: string, entrytype: string, homepage: 'text nullable' } BookCase: { title: string, latitude: 'float:10', longitude: 'float:10', address: 'text nullable', type: string, open: 'string nullable', comment: 'text nullable', contact: 'text nullable', bcz: 'text nullable', digital: boolean, icontype: string, deactivated: boolean, deactreason: string, entrytype: string, homepage: 'text nullable' }
Category: { name: string, slug: string } Category: { name: string, slug: string }
@@ -22,3 +27,4 @@ models:
TeamInvitation: { team_id: biginteger, email: string, role: 'string nullable' } TeamInvitation: { team_id: biginteger, email: string, role: 'string nullable' }
User: { name: string, public_key: 'string nullable', email: 'string nullable', email_verified_at: 'datetime nullable', password: 'string nullable', remember_token: 'string:100 nullable', current_team_id: 'biginteger nullable', profile_photo_path: 'string:2048 nullable', is_lecturer: 'boolean default:', two_factor_secret: 'text nullable', two_factor_recovery_codes: 'text nullable', two_factor_confirmed_at: 'datetime nullable', timezone: 'string default:Europe/Berlin' } User: { name: string, public_key: 'string nullable', email: 'string nullable', email_verified_at: 'datetime nullable', password: 'string nullable', remember_token: 'string:100 nullable', current_team_id: 'biginteger nullable', profile_photo_path: 'string:2048 nullable', is_lecturer: 'boolean default:', two_factor_secret: 'text nullable', two_factor_recovery_codes: 'text nullable', two_factor_confirmed_at: 'datetime nullable', timezone: 'string default:Europe/Berlin' }
Venue: { city_id: biginteger, name: string, slug: string, street: string } Venue: { city_id: biginteger, name: string, slug: string, street: string }
BitcoinEvent: { venue_id: foreign, from: datetime, to: datetime, title: string, description: text, link: string }

View 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');
}
}

View 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(),
];
}
}

View 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
View 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 [];
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Providers; namespace App\Providers;
use App\Nova\BitcoinEvent;
use App\Nova\BookCase; use App\Nova\BookCase;
use App\Nova\Category; use App\Nova\Category;
use App\Nova\City; use App\Nova\City;
@@ -54,6 +55,12 @@ class NovaServiceProvider extends NovaApplicationServiceProvider
->icon('calendar') ->icon('calendar')
->collapsable(), ->collapsable(),
MenuSection::make('Events', [
MenuItem::resource(BitcoinEvent::class),
])
->icon('star')
->collapsable(),
MenuSection::make('Schule', [ MenuSection::make('Schule', [
MenuItem::resource(City::class), MenuItem::resource(City::class),
MenuItem::resource(Venue::class), MenuItem::resource(Venue::class),

View File

@@ -0,0 +1,35 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
use App\Models\BitcoinEvent;
use App\Models\Venue;
class BitcoinEventFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = BitcoinEvent::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition(): array
{
return [
'venue_id' => Venue::factory(),
'from' => $this->faker->dateTime(),
'to' => $this->faker->dateTime(),
'title' => $this->faker->sentence(4),
'description' => $this->faker->text,
'link' => $this->faker->word,
];
}
}

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateBitcoinEventsTable extends Migration
{
/**
* Run the migrations.
* @return void
*/
public function up(): void
{
Schema::disableForeignKeyConstraints();
Schema::create('bitcoin_events', function (Blueprint $table) {
$table->id();
$table->foreignId('venue_id')
->constrained()
->cascadeOnDelete()
->cascadeOnUpdate();
$table->dateTime('from');
$table->dateTime('to');
$table->string('title');
$table->text('description')
->nullable();
$table->string('link')
->nullable();
$table->timestamps();
});
Schema::enableForeignKeyConstraints();
}
/**
* Reverse the migrations.
* @return void
*/
public function down(): void
{
Schema::dropIfExists('bitcoin_events');
}
}

View File

@@ -6,6 +6,7 @@ namespace Database\Seeders;
use App\Console\Commands\Database\CreateTags; use App\Console\Commands\Database\CreateTags;
use App\Console\Commands\Feed\ReadAndSyncEinundzwanzigPodcastFeed; use App\Console\Commands\Feed\ReadAndSyncEinundzwanzigPodcastFeed;
use App\Console\Commands\OpenBooks\SyncOpenBooks; use App\Console\Commands\OpenBooks\SyncOpenBooks;
use App\Models\BitcoinEvent;
use App\Models\Category; use App\Models\Category;
use App\Models\City; use App\Models\City;
use App\Models\Country; use App\Models\Country;
@@ -22,6 +23,7 @@ use App\Models\Team;
use App\Models\User; use App\Models\User;
use App\Models\Venue; use App\Models\Venue;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Spatie\Permission\Models\Role; use Spatie\Permission\Models\Role;
@@ -119,6 +121,11 @@ class DatabaseSeeder extends Seeder
'name' => 'The Blue Studio Coworking (Pfronten)', 'name' => 'The Blue Studio Coworking (Pfronten)',
'street' => 'Teststraße 3', 'street' => 'Teststraße 3',
]); ]);
Venue::create([
'city_id' => 4,
'name' => 'Innsbruck',
'street' => 'Innsbrucker Straße 1',
]);
Lecturer::create([ Lecturer::create([
'team_id' => 1, 'team_id' => 1,
'name' => 'Markus Turm', 'name' => 'Markus Turm',
@@ -298,5 +305,22 @@ class DatabaseSeeder extends Seeder
'description' => fake()->text(), 'description' => fake()->text(),
'link' => 'https://t.me/EinundzwanzigKempten', 'link' => 'https://t.me/EinundzwanzigKempten',
]); ]);
BitcoinEvent::create([
'venue_id' => 4,
'from' => Carbon::parse('2023-09-12')
->startOfDay()
->addHours(8),
'to' => Carbon::parse('2023-09-16')
->startOfDay()
->addHours(18),
'title' => 'BTC23',
'description' => 'The largest Bitcoin conference in German is entering the second round: The BTC23 will be even better, more diverse and quite controversial. We are open - for Bitcoiners, interested parties and skeptics from all directions. Three days with bitcoiners, thought leaders and entrepreneurs from space - full of relevant lectures, debates and conversations. And of course parties! The following applies: The BTC23 is there for everyone, no matter what level of knowledge you have on the subject. #bitcoinonly
Advance ticket sales begin on December 21, 2022 at 9:21 p.m. with time-limited early bird tickets.
Ticket presale begins on December 21, 2022 at 9:21 p.m. Be quick - there are a limited amount of early bird tickets again.
',
'link' => 'https://bconf.de/en/',
]);
} }
} }

View File

@@ -1,13 +0,0 @@
models:
Meetup:
city_id: foreign
name: string:unique
link: string
MeetupEvent:
meetup_id: foreign
date: date
start: time
end: time:nullable
location: string:nullable
description: text:nullable
link: string:nullable

View File

@@ -0,0 +1,12 @@
<div class="bg-21gray flex flex-col h-screen justify-between">
{{-- HEADER --}}
<livewire:frontend.header :country="$country"/>
{{-- MAIN --}}
<section class="w-full mb-12">
<div class="max-w-screen-2xl mx-auto px-2 sm:px-10 space-y-4" id="table">
<livewire:tables.bitcoin-event-table :country="$country->code"/>
</div>
</section>
{{-- FOOTER --}}
<livewire:frontend.footer/>
</div>

View File

@@ -66,6 +66,12 @@
Meetup-Termine Meetup-Termine
</a> </a>
@endif @endif
@if(str(request()->route()->getName())->contains('bitcoinEvent.'))
<a href="{{ route('bitcoinEvent.table.bitcoinEvent', ['country' => $c]) }}"
class="{{ request()->routeIs('bitcoinEvent.table.bitcoinEvent') ? 'text-amber-500 underline' : 'text-gray-400' }} mr-5 font-medium leading-6 hover:text-gray-300">
Veranstaltungen
</a>
@endif
</nav> </nav>
</div> </div>

View File

@@ -77,7 +77,7 @@
</div> </div>
<div <div
class="row-span-2 col-span-full sm:col-span-1 md:col-start-2 xl:col-start-3 sm:row-start-1 md:row-start-4 xl:row-start-1"> class="row-span-2 col-span-full sm:col-span-1 md:col-start-2 xl:col-start-3 sm:row-start-1 md:row-start-4 xl:row-start-1">
<a href="#" <a href="{{ route('bitcoinEvent.table.bitcoinEvent', ['country' => 'de']) }}"
class="relative flex flex-col items-start justify-end w-full h-full overflow-hidden bg-black shadow-lg rounded-xl group" class="relative flex flex-col items-start justify-end w-full h-full overflow-hidden bg-black shadow-lg rounded-xl group"
style="aspect-ratio: 1/1;"> style="aspect-ratio: 1/1;">
<div class="absolute inset-0 w-full h-full"> <div class="absolute inset-0 w-full h-full">
@@ -91,7 +91,7 @@
<span <span
class="px-2 py-1 mb-3 text-xs font-semibold tracking-tight text-white uppercase bg-amber-500 rounded-md">Worldwide</span> class="px-2 py-1 mb-3 text-xs font-semibold tracking-tight text-white uppercase bg-amber-500 rounded-md">Worldwide</span>
<h4 class="text-4xl font-bold tracking-tight text-gray-100 sm:text-3xl md:text-2xl lg:text-3xl"> <h4 class="text-4xl font-bold tracking-tight text-gray-100 sm:text-3xl md:text-2xl lg:text-3xl">
Events Veranstaltungen
</h4> </h4>
</div> </div>
</a> </a>

View File

@@ -46,6 +46,12 @@
</x-jet-nav-link> </x-jet-nav-link>
@endif @endif
@if(str(request()->route()->getName())->contains('bitcoinEvent.'))
<x-jet-nav-link href="/nova/resources/bitcoin-events" target="_blank">
{{ __('Veranstaltung eintragen') }}
</x-jet-nav-link>
@endif
<x-jet-nav-link href="{{ route('profile.show') }}" :active="request()->routeIs('profile.show')"> <x-jet-nav-link href="{{ route('profile.show') }}" :active="request()->routeIs('profile.show')">
{{ __('Mein Profil') }} {{ __('Mein Profil') }}
</x-jet-nav-link> </x-jet-nav-link>

View File

@@ -63,6 +63,14 @@ Route::middleware([])
/* /*
* Events * Events
* */ * */
Route::middleware([])
->as('bitcoinEvent.')
->prefix('meetup')
->group(function () {
Route::get('/{country:code}/table/event', \App\Http\Livewire\BitcoinEvent\BitcoinEventTable::class)
->name('table.bitcoinEvent');
});
/* /*
* Meetups * Meetups