This commit is contained in:
Sami Mazouz 2024-05-10 17:21:51 +01:00
parent 06fef7eec0
commit bf5b522818
No known key found for this signature in database
3 changed files with 6 additions and 5 deletions

View File

@ -118,7 +118,8 @@ class TagResource extends AbstractDatabaseResource
Schema\Integer::make('discussionCount'),
Schema\Integer::make('position')
->nullable(),
Schema\Str::make('defaultSort'),
Schema\Str::make('defaultSort')
->nullable(),
Schema\Boolean::make('isChild')
->get(fn (Tag $tag) => (bool) $tag->parent_id),
Schema\DateTime::make('lastPostedAt'),

View File

@ -34,7 +34,7 @@ use Illuminate\Database\Query\Builder as QueryBuilder;
* @property bool $is_primary
* @property int $position
* @property int $parent_id
* @property string $default_sort
* @property string|null $default_sort
* @property bool $is_restricted
* @property bool $is_hidden
* @property int $discussion_count

View File

@ -245,11 +245,11 @@ class PostResource extends AbstractDatabaseResource
->visible(fn (Post $post) => $post->hidden_at !== null),
Schema\Boolean::make('canEdit')
->visible(fn (Post $post, Context $context) => $context->getActor()->can('edit', $post)),
->get(fn (Post $post, Context $context) => $context->getActor()->can('edit', $post)),
Schema\Boolean::make('canDelete')
->visible(fn (Post $post, Context $context) => $context->getActor()->can('delete', $post)),
->get(fn (Post $post, Context $context) => $context->getActor()->can('delete', $post)),
Schema\Boolean::make('canHide')
->visible(fn (Post $post, Context $context) => $context->getActor()->can('hide', $post)),
->get(fn (Post $post, Context $context) => $context->getActor()->can('hide', $post)),
Schema\Relationship\ToOne::make('user')
->includable(),