This commit is contained in:
Benjamin Takats
2022-12-21 17:14:32 +01:00
parent 38161bd19e
commit 3eaa2bc2eb
191 changed files with 9005 additions and 3442 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Console\Commands\Database;
use App\Models\User;
use Illuminate\Console\Command;
class FillUserEmails extends Command
{
/**
* The name and signature of the console command.
* @var string
*/
protected $signature = 'users:emails';
/**
* The console command description.
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
* @return int
*/
public function handle()
{
$users = User::all();
foreach ($users as $user) {
// set email
if (!$user->email) {
$user->email = str($user->public_key)->substr(-6).'@portal.einundzwanzig.space';
$user->save();
}
}
return Command::SUCCESS;
}
}

View File

@@ -3,6 +3,7 @@
namespace App\Http\Livewire\BookCase;
use App\Models\BookCase;
use App\Models\User;
use Livewire\Component;
use Livewire\WithFileUploads;

View File

@@ -22,6 +22,7 @@ class Footer extends Component
$toTranslate = Translation::query()
->where('language_id', $language->id)
->count();
$toTranslate = $toTranslate > 0 ? $toTranslate : 1;
return view('livewire.frontend.footer', [
'percentTranslated' => $l === 'en' ? 100 : round(($translated / $toTranslate) * 100),

View File

@@ -7,11 +7,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Spatie\Comments\Exceptions\CannotCreateComment;
use Spatie\Comments\Models\Comment;
use Spatie\Comments\Models\Concerns\HasComments;
use Spatie\Comments\Models\Concerns\Interfaces\CanComment;
use Spatie\Comments\Support\Config;
use Spatie\Image\Manipulations;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
@@ -95,36 +91,4 @@ class BookCase extends Model implements HasMedia
{
return url()->route('bookCases.comment.bookcase', ['bookCase' => $this->id]);
}
public function comment(string $text, CanComment $commentator = null): Comment
{
// $commentator ??= auth()->user();
if (! config('comments.allow_anonymous_comments')) {
if (! $commentator) {
throw CannotCreateComment::userIsRequired();
}
}
$parentId = ($this::class === Config::getCommentModelName())
? $this->getKey()
: null;
$comment = $this->comments()->create([
'commentator_id' => $commentator?->getKey() ?? null,
'commentator_type' => $commentator?->getMorphClass() ?? null,
'original_text' => $text,
'parent_id' => $parentId,
]);
if ($comment->shouldBeAutomaticallyApproved()) {
Config::approveCommentAction()->execute($comment);
return $comment;
}
Config::sendNotificationsForPendingCommentAction()->execute($comment);
return $comment;
}
}