From 6b2ea031a9b32d94adfa1e56a06891fa88d1e6fa Mon Sep 17 00:00:00 2001 From: Benjamin Takats Date: Tue, 24 Jan 2023 15:07:18 +0100 Subject: [PATCH] lecturer v4v --- app/Nova/Lecturer.php | 11 ++++++ app/Nova/User.php | 21 ++++++++---- ...22_add_ln_addresses_to_lecturers_table.php | 34 +++++++++++++++++++ .../news/intern-article-view.blade.php | 17 ++++++++++ 4 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 database/migrations/2023_01_24_135922_add_ln_addresses_to_lecturers_table.php diff --git a/app/Nova/Lecturer.php b/app/Nova/Lecturer.php index 6d134049..d83a560d 100644 --- a/app/Nova/Lecturer.php +++ b/app/Nova/Lecturer.php @@ -88,6 +88,17 @@ class Lecturer extends Resource Text::make('Name') ->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') ->help(__('Without @')) ->rules('nullable', 'string'), diff --git a/app/Nova/User.php b/app/Nova/User.php index c46d3ddb..e766592b 100644 --- a/app/Nova/User.php +++ b/app/Nova/User.php @@ -4,11 +4,9 @@ namespace App\Nova; use App\Notifications\ModelCreatedNotification; use Illuminate\Database\Eloquent\Model; -use Illuminate\Validation\Rules; use Laravel\Nova\Fields\Gravatar; use Laravel\Nova\Fields\ID; use Laravel\Nova\Fields\MorphToMany; -use Laravel\Nova\Fields\Password; use Laravel\Nova\Fields\Text; use Laravel\Nova\Http\Requests\NovaRequest; @@ -69,16 +67,27 @@ class User extends Resource ->sortable() ->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') ->sortable() ->rules('required', 'email', 'max:254') ->creationRules('unique:users,email') ->updateRules('unique:users,email,{{resourceId}}'), - Password::make('Password') - ->onlyOnForms() - ->creationRules('required', Rules\Password::defaults()) - ->updateRules('nullable', Rules\Password::defaults()), + // Password::make('Password') + // ->onlyOnForms() + // ->creationRules('required', Rules\Password::defaults()) + // ->updateRules('nullable', Rules\Password::defaults()), MorphToMany::make('Roles', 'roles', \Itsmejoshua\Novaspatiepermissions\Role::class), diff --git a/database/migrations/2023_01_24_135922_add_ln_addresses_to_lecturers_table.php b/database/migrations/2023_01_24_135922_add_ln_addresses_to_lecturers_table.php new file mode 100644 index 00000000..546d3603 --- /dev/null +++ b/database/migrations/2023_01_24_135922_add_ln_addresses_to_lecturers_table.php @@ -0,0 +1,34 @@ +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) { + // + }); + } +}; diff --git a/resources/views/livewire/news/intern-article-view.blade.php b/resources/views/livewire/news/intern-article-view.blade.php index 0064c41f..5490f3b9 100644 --- a/resources/views/livewire/news/intern-article-view.blade.php +++ b/resources/views/livewire/news/intern-article-view.blade.php @@ -152,6 +152,23 @@ {!! $libraryItem->value !!} @endif + +
+ @if($libraryItem->lecturer->lightning_address || $libraryItem->lecturer->lnurl || $libraryItem->lecturer->node_id) +

value-4-value

+
+ +
+ @endif +
+ +