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 "".__('Show').""; }) ->asHtml(), Text::make(__('Status'), function (CommentModel $comment) { if ($comment->isApproved()) { return "