mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-07-01 20:50:23 +00:00
✨ Refactor components and models:
- 🔥 Removed deprecated `placeholder-pattern` component. - 🧹 Simplified and cleaned up Blade views by removing unused comments and sections. - 🗂️ Extracted `SetsCreatedBy` concern for DRY and reused it across models. - 🔧 Consolidated configuration for Horizon `authorized_nostr_keys`. - 🧪 Migrated media conversion to use new Spatie enums for clarity. - ♻️ Replaced repetitive link rendering with dynamic rendering in meetups and services views.
This commit is contained in:
@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Country;
|
||||
use Dedoc\Scramble\Attributes\ExcludeRouteFromDocs;
|
||||
use Dedoc\Scramble\Attributes\Group;
|
||||
use Dedoc\Scramble\Attributes\QueryParameter;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -48,28 +47,4 @@ class CountryController extends Controller
|
||||
return $country;
|
||||
});
|
||||
}
|
||||
|
||||
#[ExcludeRouteFromDocs]
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
#[ExcludeRouteFromDocs]
|
||||
public function show(Country $country)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
#[ExcludeRouteFromDocs]
|
||||
public function update(Request $request, Country $country)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
#[ExcludeRouteFromDocs]
|
||||
public function destroy(Country $country)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ use App\Http\Resources\CourseResource;
|
||||
use App\Models\Course;
|
||||
use App\Models\CourseEvent;
|
||||
use App\Models\Lecturer;
|
||||
use Dedoc\Scramble\Attributes\ExcludeRouteFromDocs;
|
||||
use Dedoc\Scramble\Attributes\Group;
|
||||
use Dedoc\Scramble\Attributes\QueryParameter;
|
||||
use Dedoc\Scramble\Attributes\Response as ResponseAttribute;
|
||||
@@ -201,10 +200,4 @@ class CourseController extends Controller
|
||||
|
||||
return CourseResource::make($course->fresh());
|
||||
}
|
||||
|
||||
#[ExcludeRouteFromDocs]
|
||||
public function destroy(Course $course)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ use App\Http\Controllers\Controller;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use JoeDixon\Translation\Language;
|
||||
use JoeDixon\Translation\Translation;
|
||||
|
||||
@@ -57,44 +56,4 @@ class LanguageController extends Controller
|
||||
|
||||
return response()->json($array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show(Language $language)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update(Request $request, Language $language)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy(Language $language)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,11 @@ final class LnurlAuthController extends Controller
|
||||
}
|
||||
|
||||
$user = $this->findOrCreateUser($validated['k1'], $validated['key']);
|
||||
$this->ensureLoginKeyExists($validated['k1'], $user->id);
|
||||
|
||||
LoginKey::query()->updateOrCreate(
|
||||
['k1' => $validated['k1']],
|
||||
['user_id' => $user->id],
|
||||
);
|
||||
|
||||
Log::info('LNURL auth successful', [
|
||||
'user_id' => $user->id,
|
||||
@@ -150,20 +154,6 @@ final class LnurlAuthController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure a login key record exists for the given challenge.
|
||||
*
|
||||
* @param string $k1 The challenge identifier
|
||||
* @param int $userId The user ID
|
||||
*/
|
||||
private function ensureLoginKeyExists(string $k1, int $userId): void
|
||||
{
|
||||
LoginKey::query()->updateOrCreate(
|
||||
['k1' => $k1],
|
||||
['user_id' => $userId],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an LNURL-compliant error response.
|
||||
*
|
||||
|
||||
@@ -11,24 +11,15 @@ class SetTimezone
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
* @param Closure(Request): (Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if (
|
||||
$request->user()
|
||||
&& $timezone = $request->user()->timezone
|
||||
) {
|
||||
config([
|
||||
'app.timezone' => $timezone,
|
||||
'app.user-timezone' => $timezone,
|
||||
]);
|
||||
$timezone = $request->user()?->timezone ?: 'Europe/Berlin';
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
config([
|
||||
'app.timezone' => 'Europe/Berlin',
|
||||
'app.user-timezone' => 'Europe/Berlin',
|
||||
'app.timezone' => $timezone,
|
||||
'app.user-timezone' => $timezone,
|
||||
]);
|
||||
|
||||
return $next($request);
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\SetsCreatedBy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Spatie\Image\Manipulations;
|
||||
use Spatie\Image\Enums\Fit;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
@@ -14,6 +15,7 @@ class BitcoinEvent extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithMedia;
|
||||
use SetsCreatedBy;
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
@@ -34,23 +36,14 @@ class BitcoinEvent extends Model implements HasMedia
|
||||
'to' => 'datetime',
|
||||
];
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (! $model->created_by) {
|
||||
$model->created_by = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function registerMediaConversions(?Media $media = null): void
|
||||
{
|
||||
$this
|
||||
->addMediaConversion('preview')
|
||||
->fit(Manipulations::FIT_CROP, 300, 300)
|
||||
->fit(Fit::Crop, 300, 300)
|
||||
->nonQueued();
|
||||
$this->addMediaConversion('thumb')
|
||||
->fit(Manipulations::FIT_CROP, 130, 130)
|
||||
->fit(Fit::Crop, 130, 130)
|
||||
->width(130)
|
||||
->height(130);
|
||||
}
|
||||
|
||||
+6
-13
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Akuechler\Geoly;
|
||||
use App\Models\Concerns\SetsCreatedBy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -13,9 +14,10 @@ use Spatie\Sluggable\SlugOptions;
|
||||
|
||||
class City extends Model
|
||||
{
|
||||
use Geoly;
|
||||
use HasFactory;
|
||||
use HasSlug;
|
||||
use Geoly;
|
||||
use SetsCreatedBy;
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
@@ -36,24 +38,15 @@ class City extends Model
|
||||
'simplified_geojson' => 'json',
|
||||
];
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (! $model->created_by) {
|
||||
$model->created_by = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the options for generating the slug.
|
||||
*/
|
||||
public function getSlugOptions(): SlugOptions
|
||||
{
|
||||
return SlugOptions::create()
|
||||
->generateSlugsFrom(['country.code', 'name'])
|
||||
->saveSlugsTo('slug')
|
||||
->usingLanguage(Cookie::get('lang', config('app.locale')));
|
||||
->generateSlugsFrom(['country.code', 'name'])
|
||||
->saveSlugsTo('slug')
|
||||
->usingLanguage(Cookie::get('lang', config('app.locale')));
|
||||
}
|
||||
|
||||
public function createdBy(): BelongsTo
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Concerns;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
trait SetsCreatedBy
|
||||
{
|
||||
public static function bootSetsCreatedBy(): void
|
||||
{
|
||||
static::creating(function (Model $model): void {
|
||||
if (auth()->check() && ! $model->created_by) {
|
||||
$model->created_by = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\SetsCreatedBy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -18,6 +19,7 @@ class Course extends Model implements HasMedia
|
||||
use HasFactory;
|
||||
use HasTags;
|
||||
use InteractsWithMedia;
|
||||
use SetsCreatedBy;
|
||||
|
||||
/**
|
||||
* @var array<int, string>
|
||||
@@ -38,15 +40,6 @@ class Course extends Model implements HasMedia
|
||||
'lecturer_id' => 'integer',
|
||||
];
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (! $model->created_by) {
|
||||
$model->created_by = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function registerMediaConversions(?Media $media = null): void
|
||||
{
|
||||
$this
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\SetsCreatedBy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -10,6 +11,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
class CourseEvent extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SetsCreatedBy;
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
@@ -31,15 +33,6 @@ class CourseEvent extends Model
|
||||
'to' => 'datetime',
|
||||
];
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (! $model->created_by) {
|
||||
$model->created_by = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function createdBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\SetsCreatedBy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -12,6 +13,7 @@ class Episode extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasTags;
|
||||
use SetsCreatedBy;
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
@@ -31,15 +33,6 @@ class Episode extends Model
|
||||
'data' => 'array',
|
||||
];
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (! $model->created_by) {
|
||||
$model->created_by = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function createdBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
|
||||
+2
-14
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\SetsCreatedBy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -20,6 +21,7 @@ class Lecturer extends Model implements HasMedia
|
||||
use HasFactory;
|
||||
use HasSlug;
|
||||
use InteractsWithMedia;
|
||||
use SetsCreatedBy;
|
||||
|
||||
/**
|
||||
* @var array<int, string>
|
||||
@@ -51,15 +53,6 @@ class Lecturer extends Model implements HasMedia
|
||||
'active' => 'boolean',
|
||||
];
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (! $model->created_by) {
|
||||
$model->created_by = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function registerMediaConversions(?Media $media = null): void
|
||||
{
|
||||
$this
|
||||
@@ -99,11 +92,6 @@ class Lecturer extends Model implements HasMedia
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
|
||||
public function team(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Team::class);
|
||||
}
|
||||
|
||||
public function courses(): HasMany
|
||||
{
|
||||
return $this->hasMany(Course::class);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\SetsCreatedBy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -10,6 +11,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
class Library extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SetsCreatedBy;
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
@@ -28,15 +30,6 @@ class Library extends Model
|
||||
'language_codes' => 'array',
|
||||
];
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (! $model->created_by) {
|
||||
$model->created_by = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function createdBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\SetsCreatedBy;
|
||||
use App\Support\CustomFeedItem;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -11,7 +12,7 @@ use Illuminate\Support\Facades\Cookie;
|
||||
use Spatie\EloquentSortable\Sortable;
|
||||
use Spatie\EloquentSortable\SortableTrait;
|
||||
use Spatie\Feed\Feedable;
|
||||
use Spatie\Image\Manipulations;
|
||||
use Spatie\Image\Enums\Fit;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
@@ -27,6 +28,7 @@ class LibraryItem extends Model implements Feedable, HasMedia, Sortable
|
||||
use HasStatuses;
|
||||
use HasTags;
|
||||
use InteractsWithMedia;
|
||||
use SetsCreatedBy;
|
||||
use SortableTrait;
|
||||
|
||||
/**
|
||||
@@ -60,15 +62,6 @@ class LibraryItem extends Model implements Feedable, HasMedia, Sortable
|
||||
->get();
|
||||
}
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (! $model->created_by) {
|
||||
$model->created_by = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function getSlugOptions(): SlugOptions
|
||||
{
|
||||
return SlugOptions::create()
|
||||
@@ -81,13 +74,13 @@ class LibraryItem extends Model implements Feedable, HasMedia, Sortable
|
||||
{
|
||||
$this
|
||||
->addMediaConversion('preview')
|
||||
->fit(Manipulations::FIT_CROP, 300, 300)
|
||||
->fit(Fit::Crop, 300, 300)
|
||||
->nonQueued();
|
||||
$this->addMediaConversion('seo')
|
||||
->fit(Manipulations::FIT_CROP, 1200, 630)
|
||||
->fit(Fit::Crop, 1200, 630)
|
||||
->nonQueued();
|
||||
$this->addMediaConversion('thumb')
|
||||
->fit(Manipulations::FIT_CROP, 130, 130)
|
||||
->fit(Fit::Crop, 130, 130)
|
||||
->width(130)
|
||||
->height(130);
|
||||
}
|
||||
@@ -149,17 +142,4 @@ class LibraryItem extends Model implements Feedable, HasMedia, Sortable
|
||||
->link(url()->route('article.view', ['libraryItem' => $this]))
|
||||
->authorName($this->lecturer->name);
|
||||
}
|
||||
|
||||
public static function searchLibraryItems($type, $value = null)
|
||||
{
|
||||
$query = self::query()
|
||||
->where('type', $type)
|
||||
->latest('id');
|
||||
|
||||
if ($value) {
|
||||
$query->whereLike('name', "%{$value}%");
|
||||
}
|
||||
|
||||
return $query->get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\SetsCreatedBy;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
@@ -24,6 +25,7 @@ class Meetup extends Model implements HasMedia
|
||||
use HasFactory;
|
||||
use HasSlug;
|
||||
use InteractsWithMedia;
|
||||
use SetsCreatedBy;
|
||||
|
||||
/**
|
||||
* @var array<int, string>
|
||||
@@ -120,12 +122,6 @@ class Meetup extends Model implements HasMedia
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (! $model->created_by) {
|
||||
$model->created_by = auth()->id();
|
||||
}
|
||||
});
|
||||
|
||||
// Der Ersteller wird automatisch als Leiter in die meetup_user-Pivot eingetragen,
|
||||
// damit das Meetup einheitlich (MCP, REST-API, Livewire) in „Meine Meetups"
|
||||
// erscheint – egal über welchen Pfad es angelegt wurde.
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use App\Enums\RecurrenceType;
|
||||
use App\Enums\RsvpStatus;
|
||||
use App\Models\Concerns\SetsCreatedBy;
|
||||
use App\Observers\MeetupEventObserver;
|
||||
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -16,6 +17,7 @@ use Illuminate\Support\Collection;
|
||||
class MeetupEvent extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SetsCreatedBy;
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
@@ -47,15 +49,6 @@ class MeetupEvent extends Model
|
||||
'recurrence_type' => RecurrenceType::class,
|
||||
];
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (! $model->created_by) {
|
||||
$model->created_by = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Termine, die der Nutzer bearbeiten darf: selbst angelegt ODER Leader des
|
||||
* zugehörigen Meetups (deckungsgleich mit MeetupEventPolicy::update).
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\SetsCreatedBy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -10,6 +11,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
class Podcast extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SetsCreatedBy;
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
@@ -28,15 +30,6 @@ class Podcast extends Model
|
||||
'data' => 'array',
|
||||
];
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (! $model->created_by) {
|
||||
$model->created_by = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function createdBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\SetsCreatedBy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Facades\Cookie;
|
||||
use Spatie\Image\Manipulations;
|
||||
use Spatie\Image\Enums\Fit;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
@@ -19,6 +20,7 @@ class ProjectProposal extends Model implements HasMedia
|
||||
use HasFactory;
|
||||
use HasSlug;
|
||||
use InteractsWithMedia;
|
||||
use SetsCreatedBy;
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
@@ -37,15 +39,6 @@ class ProjectProposal extends Model implements HasMedia
|
||||
'user_id' => 'integer',
|
||||
];
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (! $model->created_by) {
|
||||
$model->created_by = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function getSlugOptions(): SlugOptions
|
||||
{
|
||||
return SlugOptions::create()
|
||||
@@ -58,10 +51,10 @@ class ProjectProposal extends Model implements HasMedia
|
||||
{
|
||||
$this
|
||||
->addMediaConversion('preview')
|
||||
->fit(Manipulations::FIT_CROP, 300, 300)
|
||||
->fit(Fit::Crop, 300, 300)
|
||||
->nonQueued();
|
||||
$this->addMediaConversion('thumb')
|
||||
->fit(Manipulations::FIT_CROP, 130, 130)
|
||||
->fit(Fit::Crop, 130, 130)
|
||||
->width(130)
|
||||
->height(130);
|
||||
}
|
||||
|
||||
@@ -108,21 +108,11 @@ class User extends Authenticatable implements CipherSweetEncrypted
|
||||
return $this->belongsToMany(Meetup::class)->withPivot('is_leader');
|
||||
}
|
||||
|
||||
public function reputations()
|
||||
{
|
||||
return $this->morphMany('QCod\Gamify\Reputation', 'subject');
|
||||
}
|
||||
|
||||
public function votes()
|
||||
{
|
||||
return $this->hasMany(Vote::class);
|
||||
}
|
||||
|
||||
public function paidArticles()
|
||||
{
|
||||
return $this->belongsToMany(LibraryItem::class, 'library_item_user', 'user_id', 'library_item_id');
|
||||
}
|
||||
|
||||
public function updateProfilePhoto(UploadedFile $photo)
|
||||
{
|
||||
tap($this->profile_photo_path, function ($previous) use ($photo) {
|
||||
|
||||
+2
-21
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\SetsCreatedBy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -13,14 +14,13 @@ use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
use Spatie\Sluggable\HasSlug;
|
||||
use Spatie\Sluggable\SlugOptions;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class Venue extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory;
|
||||
use HasRelationships;
|
||||
use HasSlug;
|
||||
use InteractsWithMedia;
|
||||
use SetsCreatedBy;
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
@@ -39,15 +39,6 @@ class Venue extends Model implements HasMedia
|
||||
'city_id' => 'integer',
|
||||
];
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (! $model->created_by) {
|
||||
$model->created_by = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function registerMediaConversions(?Media $media = null): void
|
||||
{
|
||||
$this
|
||||
@@ -88,16 +79,6 @@ class Venue extends Model implements HasMedia
|
||||
return $this->belongsTo(City::class);
|
||||
}
|
||||
|
||||
public function lecturers()
|
||||
{
|
||||
return $this->hasManyDeepFromRelations($this->courses(), (new Course)->lecturer());
|
||||
}
|
||||
|
||||
public function courses()
|
||||
{
|
||||
return $this->hasManyDeepFromRelations($this->events(), (new CourseEvent)->course());
|
||||
}
|
||||
|
||||
public function courseEvents(): HasMany
|
||||
{
|
||||
return $this->hasMany(CourseEvent::class);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Laravel\Horizon\Horizon;
|
||||
use Laravel\Horizon\HorizonApplicationServiceProvider;
|
||||
|
||||
class HorizonServiceProvider extends HorizonApplicationServiceProvider
|
||||
@@ -14,10 +13,6 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
|
||||
public function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
// Horizon::routeSmsNotificationsTo('15556667777');
|
||||
// Horizon::routeMailNotificationsTo('example@example.com');
|
||||
// Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,11 +23,10 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
|
||||
protected function gate(): void
|
||||
{
|
||||
Gate::define('viewHorizon', function ($user = null) {
|
||||
return in_array(optional($user)->nostr, [
|
||||
'npub1kz50hl2fk8rkkax3mv8kzx7vdhh3nmuegncsaj8r23w2a49nf3wsne6ejy',
|
||||
'npub1pt0kw36ue3w2g4haxq3wgm6a2fhtptmzsjlc2j2vphtcgle72qesgpjyc6',
|
||||
'npub1qwj482ffpvnwy4g7twejs4ckgnag9yxpjndqslk6juagmngwwhfsqfe5vq',
|
||||
]);
|
||||
return in_array(
|
||||
optional($user)->nostr,
|
||||
config('horizon.authorized_nostr_keys', []),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,22 @@ return [
|
||||
|
||||
'middleware' => ['web'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authorized Nostr Keys
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These Nostr public keys (npub) are allowed to access the Horizon
|
||||
| dashboard via the "viewHorizon" gate in non-local environments.
|
||||
|
|
||||
*/
|
||||
|
||||
'authorized_nostr_keys' => [
|
||||
'npub1kz50hl2fk8rkkax3mv8kzx7vdhh3nmuegncsaj8r23w2a49nf3wsne6ejy',
|
||||
'npub1pt0kw36ue3w2g4haxq3wgm6a2fhtptmzsjlc2j2vphtcgle72qesgpjyc6',
|
||||
'npub1qwj482ffpvnwy4g7twejs4ckgnag9yxpjndqslk6juagmngwwhfsqfe5vq',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Wait Time Thresholds
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
@props([
|
||||
'id' => uniqid(),
|
||||
])
|
||||
|
||||
<svg {{ $attributes }} fill="none">
|
||||
<defs>
|
||||
<pattern id="pattern-{{ $id }}" x="0" y="0" width="8" height="8" patternUnits="userSpaceOnUse">
|
||||
<path d="M-1 5L5 -1M3 9L8.5 3.5" stroke-width="0.5"></path>
|
||||
</pattern>
|
||||
</defs>
|
||||
<rect stroke="none" fill="url(#pattern-{{ $id }})" width="100%" height="100%"></rect>
|
||||
</svg>
|
||||
@@ -42,11 +42,9 @@ class extends Component {
|
||||
:description="__('This is a secure area of the application. Please confirm your password before continuing.')"
|
||||
/>
|
||||
|
||||
<!-- Session Status -->
|
||||
<x-auth-session-status class="text-center" :status="session('status')"/>
|
||||
|
||||
<form wire:submit="confirmPassword" class="flex flex-col gap-6">
|
||||
<!-- Password -->
|
||||
<flux:input
|
||||
wire:model="password"
|
||||
:label="__('Password')"
|
||||
|
||||
@@ -30,11 +30,9 @@ class extends Component {
|
||||
<x-auth-header :title="__('Forgot password')"
|
||||
:description="__('Enter your email to receive a password reset link')"/>
|
||||
|
||||
<!-- Session Status -->
|
||||
<x-auth-session-status class="text-center" :status="session('status')"/>
|
||||
|
||||
<form wire:submit="sendPasswordResetLink" class="flex flex-col gap-6">
|
||||
<!-- Email Address -->
|
||||
<flux:input
|
||||
wire:model="email"
|
||||
:label="__('Email Address')"
|
||||
|
||||
@@ -135,33 +135,6 @@ class extends Component {
|
||||
['country' => str(session('lang_country', config('app.domain_country')))->after('-')->lower()],
|
||||
absolute: false),
|
||||
);
|
||||
|
||||
return;
|
||||
|
||||
$this->validate();
|
||||
|
||||
$this->ensureIsNotRateLimited();
|
||||
|
||||
if (!Auth::attempt(['email' => $this->email, 'password' => $this->password], $this->remember)) {
|
||||
RateLimiter::hit($this->throttleKey());
|
||||
|
||||
throw ValidationException::withMessages([
|
||||
'email' => __('auth.failed'),
|
||||
]);
|
||||
}
|
||||
|
||||
RateLimiter::clear($this->throttleKey());
|
||||
Session::regenerate();
|
||||
session([
|
||||
'lang_country' => $this->currentLangCountry,
|
||||
]);
|
||||
|
||||
$this->redirectIntended(
|
||||
default: route('dashboard',
|
||||
['country' => str(session('lang_country', config('app.domain_country')))->after('-')->lower()],
|
||||
absolute: false),
|
||||
navigate: true,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -276,7 +249,6 @@ class extends Component {
|
||||
data-nostr-challenge="{{ $nostrChallenge ?? '' }}">
|
||||
<div class="flex-1 flex justify-center items-center">
|
||||
<div class="w-80 max-w-80 space-y-6">
|
||||
<!-- Logo -->
|
||||
<div class="flex justify-center">
|
||||
<a href="/" class="group flex items-center gap-3">
|
||||
<div class="h-24 m-12 [:where(&)]:size-32 [:where(&)]:text-base">
|
||||
@@ -285,16 +257,12 @@ class extends Component {
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Welcome Heading -->
|
||||
<flux:heading class="text-center" size="xl">{{ __('Willkommen zurück') }}</flux:heading>
|
||||
|
||||
<!-- Session Status -->
|
||||
<x-auth-session-status class="text-center" :status="session('status')"/>
|
||||
|
||||
<!-- Login Form -->
|
||||
<div class="flex flex-col gap-6">
|
||||
|
||||
<!-- Submit Button -->
|
||||
<flux:button variant="primary"
|
||||
@click="openNostrLogin"
|
||||
icon="cursor-arrow-ripple"
|
||||
@@ -344,22 +312,18 @@ class extends Component {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Language Selection Accordion -->
|
||||
<livewire:language.selector/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right Side Panel -->
|
||||
<div class="flex-1 p-4 max-lg:hidden">
|
||||
<div class="text-white relative rounded-lg h-full w-full bg-zinc-900 flex flex-col items-start justify-end p-16"
|
||||
style="background-image: url('https://dergigi.com/assets/images/bitcoin-is-time.jpg'); background-size: cover">
|
||||
|
||||
<!-- Testimonial -->
|
||||
<div class="mb-6 italic font-base text-3xl xl:text-4xl">
|
||||
Bitcoin, not blockchain. Bitcoin, not crypto.
|
||||
</div>
|
||||
|
||||
<!-- Author Info -->
|
||||
<div class="flex gap-4">
|
||||
<flux:avatar src="https://dergigi.com/assets/images/avatar.jpg" size="xl"/>
|
||||
<div class="flex flex-col justify-center font-medium">
|
||||
|
||||
@@ -75,11 +75,9 @@ class extends Component {
|
||||
<div class="flex flex-col gap-6">
|
||||
<x-auth-header :title="__('Reset password')" :description="__('Please enter your new password below')"/>
|
||||
|
||||
<!-- Session Status -->
|
||||
<x-auth-session-status class="text-center" :status="session('status')"/>
|
||||
|
||||
<form wire:submit="resetPassword" class="flex flex-col gap-6">
|
||||
<!-- Email Address -->
|
||||
<flux:input
|
||||
wire:model="email"
|
||||
:label="__('Email')"
|
||||
@@ -88,7 +86,6 @@ class extends Component {
|
||||
autocomplete="email"
|
||||
/>
|
||||
|
||||
<!-- Password -->
|
||||
<flux:input
|
||||
wire:model="password"
|
||||
:label="__('Password')"
|
||||
@@ -99,7 +96,6 @@ class extends Component {
|
||||
viewable
|
||||
/>
|
||||
|
||||
<!-- Confirm Password -->
|
||||
<flux:input
|
||||
wire:model="password_confirmation"
|
||||
:label="__('Confirm password')"
|
||||
|
||||
@@ -138,48 +138,26 @@ class extends Component {
|
||||
</flux:table.cell>
|
||||
|
||||
<flux:table.cell>
|
||||
@php
|
||||
$socialLinks = [
|
||||
['value' => $meetup->telegram_link, 'href' => $meetup->telegram_link, 'icon' => 'paper-airplane', 'title' => __('Telegram')],
|
||||
['value' => $meetup->webpage, 'href' => $meetup->webpage, 'icon' => 'globe-alt', 'title' => __('Website')],
|
||||
['value' => $meetup->twitter_username, 'href' => 'https://twitter.com/'.$meetup->twitter_username, 'icon' => 'x-mark', 'title' => __('Twitter')],
|
||||
['value' => $meetup->matrix_group, 'href' => $meetup->matrix_group, 'icon' => 'chat-bubble-left', 'title' => __('Matrix')],
|
||||
['value' => $meetup->nostr, 'href' => 'https://njump.me/'.$meetup->nostr, 'icon' => 'bolt', 'title' => __('Nostr')],
|
||||
['value' => $meetup->simplex, 'href' => $meetup->simplex, 'icon' => 'chat-bubble-bottom-center-text', 'title' => __('Simplex')],
|
||||
['value' => $meetup->signal, 'href' => $meetup->signal, 'icon' => 'shield-check', 'title' => __('Signal')],
|
||||
];
|
||||
@endphp
|
||||
<div class="flex gap-2">
|
||||
@if($meetup->telegram_link)
|
||||
<flux:link :href="$meetup->telegram_link" external variant="subtle"
|
||||
title="{{ __('Telegram') }}">
|
||||
<flux:icon.paper-airplane variant="mini"/>
|
||||
</flux:link>
|
||||
@endif
|
||||
@if($meetup->webpage)
|
||||
<flux:link :href="$meetup->webpage" external variant="subtle"
|
||||
title="{{ __('Website') }}">
|
||||
<flux:icon.globe-alt variant="mini"/>
|
||||
</flux:link>
|
||||
@endif
|
||||
@if($meetup->twitter_username)
|
||||
<flux:link :href="'https://twitter.com/' . $meetup->twitter_username" external
|
||||
variant="subtle" title="{{ __('Twitter') }}">
|
||||
<flux:icon.x-mark variant="mini"/>
|
||||
</flux:link>
|
||||
@endif
|
||||
@if($meetup->matrix_group)
|
||||
<flux:link :href="$meetup->matrix_group" external variant="subtle"
|
||||
title="{{ __('Matrix') }}">
|
||||
<flux:icon.chat-bubble-left variant="mini"/>
|
||||
</flux:link>
|
||||
@endif
|
||||
@if($meetup->nostr)
|
||||
<flux:link :href="'https://njump.me/'.$meetup->nostr" external variant="subtle"
|
||||
title="{{ __('Nostr') }}">
|
||||
<flux:icon.bolt variant="mini"/>
|
||||
</flux:link>
|
||||
@endif
|
||||
@if($meetup->simplex)
|
||||
<flux:link :href="$meetup->simplex" external variant="subtle"
|
||||
title="{{ __('Simplex') }}">
|
||||
<flux:icon.chat-bubble-bottom-center-text variant="mini"/>
|
||||
</flux:link>
|
||||
@endif
|
||||
@if($meetup->signal)
|
||||
<flux:link :href="$meetup->signal" external variant="subtle" title="{{ __('Signal') }}">
|
||||
<flux:icon.shield-check variant="mini"/>
|
||||
</flux:link>
|
||||
@endif
|
||||
@foreach($socialLinks as $socialLink)
|
||||
@if($socialLink['value'])
|
||||
<flux:link :href="$socialLink['href']" external variant="subtle"
|
||||
title="{{ $socialLink['title'] }}">
|
||||
<flux:icon name="{{ $socialLink['icon'] }}" variant="mini"/>
|
||||
</flux:link>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</flux:table.cell>
|
||||
|
||||
|
||||
@@ -107,71 +107,33 @@ class extends Component {
|
||||
</flux:table.cell>
|
||||
|
||||
<flux:table.cell>
|
||||
@php
|
||||
$serviceUrls = [
|
||||
['href' => $service->url_clearnet, 'color' => 'text-blue-600 dark:text-blue-400', 'icon' => 'globe-alt', 'label' => 'Clearnet'],
|
||||
['href' => $service->url_onion, 'color' => 'text-purple-600 dark:text-purple-400', 'icon' => 'lock-closed', 'label' => 'Onion'],
|
||||
['href' => $service->url_i2p, 'color' => 'text-green-600 dark:text-green-400', 'icon' => 'link', 'label' => 'I2P'],
|
||||
['href' => $service->url_pkdns, 'color' => 'text-orange-600 dark:text-orange-400', 'icon' => 'link', 'label' => 'pkdns'],
|
||||
];
|
||||
@endphp
|
||||
<div class="flex flex-col gap-1">
|
||||
@if($service->url_clearnet)
|
||||
<div class="flex items-center gap-2">
|
||||
<flux:tooltip content="{{ $service->url_clearnet }}">
|
||||
<flux:link :href="$service->url_clearnet" external
|
||||
class="text-blue-600 dark:text-blue-400">
|
||||
<flux:icon.globe-alt variant="mini" class="inline"/>
|
||||
Clearnet
|
||||
</flux:link>
|
||||
</flux:tooltip>
|
||||
<div x-copy-to-clipboard="'{{ $service->url_clearnet }}'">
|
||||
<flux:button icon="clipboard" size="xs" variant="ghost" class="cursor-pointer">
|
||||
{{ __('Copy') }}
|
||||
</flux:button>
|
||||
@foreach($serviceUrls as $serviceUrl)
|
||||
@if($serviceUrl['href'])
|
||||
<div class="flex items-center gap-2">
|
||||
<flux:tooltip content="{{ $serviceUrl['href'] }}">
|
||||
<flux:link :href="$serviceUrl['href']" external
|
||||
class="{{ $serviceUrl['color'] }}">
|
||||
<flux:icon name="{{ $serviceUrl['icon'] }}" variant="mini" class="inline"/>
|
||||
{{ $serviceUrl['label'] }}
|
||||
</flux:link>
|
||||
</flux:tooltip>
|
||||
<div x-copy-to-clipboard="'{{ $serviceUrl['href'] }}'">
|
||||
<flux:button icon="clipboard" size="xs" variant="ghost" class="cursor-pointer">
|
||||
{{ __('Copy') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@if($service->url_onion)
|
||||
<div class="flex items-center gap-2">
|
||||
<flux:tooltip content="{{ $service->url_onion }}">
|
||||
<flux:link :href="$service->url_onion" external
|
||||
class="text-purple-600 dark:text-purple-400">
|
||||
<flux:icon.lock-closed variant="mini" class="inline"/>
|
||||
Onion
|
||||
</flux:link>
|
||||
</flux:tooltip>
|
||||
<div x-copy-to-clipboard="'{{ $service->url_onion }}'">
|
||||
<flux:button icon="clipboard" size="xs" variant="ghost" class="cursor-pointer">
|
||||
{{ __('Copy') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@if($service->url_i2p)
|
||||
<div class="flex items-center gap-2">
|
||||
<flux:tooltip content="{{ $service->url_i2p }}">
|
||||
<flux:link :href="$service->url_i2p" external
|
||||
class="text-green-600 dark:text-green-400">
|
||||
<flux:icon.link variant="mini" class="inline"/>
|
||||
I2P
|
||||
</flux:link>
|
||||
</flux:tooltip>
|
||||
<div x-copy-to-clipboard="'{{ $service->url_i2p }}'">
|
||||
<flux:button icon="clipboard" size="xs" variant="ghost" class="cursor-pointer">
|
||||
{{ __('Copy') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@if($service->url_pkdns)
|
||||
<div class="flex items-center gap-2">
|
||||
<flux:tooltip content="{{ $service->url_pkdns }}">
|
||||
<flux:link :href="$service->url_pkdns" external
|
||||
class="text-orange-600 dark:text-orange-400">
|
||||
<flux:icon.link variant="mini" class="inline"/>
|
||||
pkdns
|
||||
</flux:link>
|
||||
</flux:tooltip>
|
||||
<div x-copy-to-clipboard="'{{ $service->url_pkdns }}'">
|
||||
<flux:button icon="clipboard" size="xs" variant="ghost" class="cursor-pointer">
|
||||
{{ __('Copy') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
@endforeach
|
||||
@if($service->ip)
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-mono text-sm text-gray-700 dark:text-gray-300">
|
||||
|
||||
Reference in New Issue
Block a user