lecturer v4v

This commit is contained in:
Benjamin Takats
2023-01-24 15:07:18 +01:00
parent 4d6cce5dab
commit 6b2ea031a9
4 changed files with 77 additions and 6 deletions

View File

@@ -88,6 +88,17 @@ class Lecturer extends Resource
Text::make('Name') Text::make('Name')
->rules('required', 'string'), ->rules('required', 'string'),
Text::make(__('Lightning Address'), 'lightning_address')
->help(__('for example xy@getalby.com'))
->rules('nullable', 'string'),
Text::make(__('LNURL'), 'lnurl')
->help(__('starts with: lnurl1dp68gurn8gh....'))
->rules('nullable', 'string'),
Text::make(__('Node Id'), 'node_id')
->rules('nullable', 'string'),
Text::make('Twitter username', 'twitter_username') Text::make('Twitter username', 'twitter_username')
->help(__('Without @')) ->help(__('Without @'))
->rules('nullable', 'string'), ->rules('nullable', 'string'),

View File

@@ -4,11 +4,9 @@ namespace App\Nova;
use App\Notifications\ModelCreatedNotification; use App\Notifications\ModelCreatedNotification;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Validation\Rules;
use Laravel\Nova\Fields\Gravatar; use Laravel\Nova\Fields\Gravatar;
use Laravel\Nova\Fields\ID; use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\MorphToMany; use Laravel\Nova\Fields\MorphToMany;
use Laravel\Nova\Fields\Password;
use Laravel\Nova\Fields\Text; use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest; use Laravel\Nova\Http\Requests\NovaRequest;
@@ -69,16 +67,27 @@ class User extends Resource
->sortable() ->sortable()
->rules('required', 'max:255'), ->rules('required', 'max:255'),
Text::make(__('Lightning Address'), 'lightning_address')
->help(__('for example xy@getalby.com'))
->rules('nullable', 'string'),
Text::make(__('LNURL'), 'lnurl')
->help(__('starts with: lnurl1dp68gurn8gh....'))
->rules('nullable', 'string'),
Text::make(__('Node Id'), 'node_id')
->rules('nullable', 'string'),
Text::make('Email') Text::make('Email')
->sortable() ->sortable()
->rules('required', 'email', 'max:254') ->rules('required', 'email', 'max:254')
->creationRules('unique:users,email') ->creationRules('unique:users,email')
->updateRules('unique:users,email,{{resourceId}}'), ->updateRules('unique:users,email,{{resourceId}}'),
Password::make('Password') // Password::make('Password')
->onlyOnForms() // ->onlyOnForms()
->creationRules('required', Rules\Password::defaults()) // ->creationRules('required', Rules\Password::defaults())
->updateRules('nullable', Rules\Password::defaults()), // ->updateRules('nullable', Rules\Password::defaults()),
MorphToMany::make('Roles', 'roles', \Itsmejoshua\Novaspatiepermissions\Role::class), MorphToMany::make('Roles', 'roles', \Itsmejoshua\Novaspatiepermissions\Role::class),

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
* @return void
*/
public function up()
{
Schema::table('lecturers', function (Blueprint $table) {
$table->text('lightning_address')
->nullable();
$table->text('lnurl')
->nullable();
$table->string('node_id')
->nullable();
});
}
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
Schema::table('lecturers', function (Blueprint $table) {
//
});
}
};

View File

@@ -152,6 +152,23 @@
{!! $libraryItem->value !!} {!! $libraryItem->value !!}
</x-markdown> </x-markdown>
@endif @endif
<div class="flex flex-col sm:flex-row justify-center space-x-4 border-t border-white py-4">
@if($libraryItem->lecturer->lightning_address || $libraryItem->lecturer->lnurl || $libraryItem->lecturer->node_id)
<h1>value-4-value</h1>
<div wire:ignore>
<lightning-widget
name="{{ $libraryItem->lecturer->name }}"
accent="#f7931a"
to="{{ $libraryItem->lecturer->lightning_address ?? $libraryItem->lecturer->lnurl ?? $libraryItem->lecturer->node_id }}"
image="{{ $libraryItem->lecturer->getFirstMediaUrl('avatar') }}"
amounts="21,210,2100,21000"
/>
</div>
@endif
</div>
<script src="https://embed.twentyuno.net/js/app.js"></script>
</div> </div>
</div> </div>
</div> </div>