add webln test page

This commit is contained in:
fsociety
2024-09-10 20:29:50 +02:00
parent 0260a61e7e
commit 2077cc9941
509 changed files with 5167 additions and 2240 deletions

View File

@@ -128,8 +128,6 @@ class BookCase extends Resource
HasMany::make(__('OrangePills'), 'orangePills', OrangePill::class),
MorphMany::make(__('Comments'), 'comments', Comment::class),
BelongsTo::make(__('Created By'), 'createdBy', User::class)
->canSee(function ($request) {
return $request->user()

View File

@@ -1,83 +0,0 @@
<?php
namespace App\Nova;
use App\Notifications\ModelCreatedNotification;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\DateTime;
use Laravel\Nova\Fields\Markdown;
use Laravel\Nova\Fields\MorphTo;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
use Spatie\Comments\Models\Comment as CommentModel;
class Comment extends Resource
{
public static $model = CommentModel::class;
public static $search = [
'id', 'text',
];
public static function authorizedToCreate(Request $request)
{
return auth()
->user()
?->hasRole('super-admin');
}
public function authorizedToUpdate(Request $request)
{
return auth()
->user()
?->hasRole('super-admin');
}
public static function afterCreate(NovaRequest $request, Model $model)
{
\App\Models\User::find(1)
->notify(new ModelCreatedNotification($model, str($request->getRequestUri())
->after('/nova-api/')
->before('?')
->toString()));
}
public function fields(NovaRequest $request)
{
return [
Text::make(__('Title'), function (CommentModel $comment) {
return $comment->topLevel()->commentable?->commentableName() ?? 'Deleted...';
})
->readonly(),
MorphTo::make(__('Commentator'), 'commentator')
->types([
User::class,
]),
Markdown::make(__('Original text'), 'original_text'),
Text::make('', function (CommentModel $comment) {
if (! $url = $comment?->commentUrl()) {
return '';
}
return "<a target=\"show_comment\" href=\"{$url}\">".__('Show').'</a>';
})
->asHtml(),
Text::make(__('Status'), function (CommentModel $comment) {
if ($comment->isApproved()) {
return "<div class='inline-flex items-center px-3 py-0.5 rounded-full text-sm font-medium bg-green-100 text-green-800'>Approved</div>";
}
return "<div class='inline-flex items-center px-3 py-0.5 rounded-full text-sm font-medium bg-yellow-100 text-yellow-800'>Pending</div>";
})
->asHtml(),
DateTime::make(__('Created at'), 'created_at'),
];
}
}