allowElement('p', ['style']) ->allowElement('h2', ['style']) ->allowElement('h3', ['style']) ->allowElement('strong') ->allowElement('b') ->allowElement('em') ->allowElement('i') ->allowElement('u') ->allowElement('s') ->allowElement('strike') ->allowElement('ul') ->allowElement('ol') ->allowElement('li') ->allowElement('blockquote') ->allowElement('br') ->allowElement('a', ['href']) ->allowElement('img', ['src', 'alt']) ->allowLinkSchemes(['http', 'https', 'mailto']) ->allowMediaSchemes(['https']) ->withAttributeSanitizer(new TextAlignAttributeSanitizer); $this->sanitizer = new HtmlSanitizer($config); } public function paginated(User $user, int $perPage = 25, string $search = '', ?string $type = null, ?string $status = null): LengthAwarePaginator { return Feedback::query() ->where('user_id', $user->id) ->when($search, fn ($q) => $q->where('subject', 'like', "%{$search}%")) ->when($type, fn ($q) => $q->where('type', $type)) ->when($status, fn ($q) => $q->where('status', $status)) ->latest() ->paginate($perPage); } public function create(User $user, array $data): Feedback { return Feedback::create([ 'user_id' => $user->id, 'type' => $data['type'], 'subject' => $data['subject'], 'message' => $this->sanitizer->sanitize($data['message']), ]); } public function update(Feedback $feedback, array $data): Feedback { $feedback->type = $data['type']; $feedback->subject = $data['subject']; $feedback->message = $this->sanitizer->sanitize($data['message']); $feedback->update(); return $feedback; } public function delete(Feedback $feedback): bool { return $feedback->delete(); } }