1
0
mirror of https://github.com/flarum/core.git synced 2025-08-04 07:27:39 +02:00
This commit is contained in:
Sami Mazouz
2024-05-10 17:21:51 +01:00
parent 06fef7eec0
commit bf5b522818
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('discussionCount'),
Schema\Integer::make('position') Schema\Integer::make('position')
->nullable(), ->nullable(),
Schema\Str::make('defaultSort'), Schema\Str::make('defaultSort')
->nullable(),
Schema\Boolean::make('isChild') Schema\Boolean::make('isChild')
->get(fn (Tag $tag) => (bool) $tag->parent_id), ->get(fn (Tag $tag) => (bool) $tag->parent_id),
Schema\DateTime::make('lastPostedAt'), Schema\DateTime::make('lastPostedAt'),

View File

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

View File

@@ -245,11 +245,11 @@ class PostResource extends AbstractDatabaseResource
->visible(fn (Post $post) => $post->hidden_at !== null), ->visible(fn (Post $post) => $post->hidden_at !== null),
Schema\Boolean::make('canEdit') 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') 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') 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') Schema\Relationship\ToOne::make('user')
->includable(), ->includable(),