Skip to content
This repository was archived by the owner on Jan 28, 2026. It is now read-only.

Commit 2ae9a9c

Browse files
Merge pull request #189 from package-wizard/phoenix
Fix for placeholder
2 parents 90bcfa2 + 67ecace commit 2ae9a9c

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

app/Data/Casts/PlaceholderCast.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace PackageWizard\Installer\Data\Casts;
4+
5+
use Spatie\LaravelData\Casts\Cast;
6+
use Spatie\LaravelData\Support\Creation\CreationContext;
7+
use Spatie\LaravelData\Support\DataProperty;
8+
9+
use function __;
10+
use function blank;
11+
12+
class PlaceholderCast implements Cast
13+
{
14+
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): string
15+
{
16+
if (blank($value)) {
17+
return '';
18+
}
19+
20+
return __('form.eg', ['value' => $value]);
21+
}
22+
}

app/Data/Questions/QuestionAskTextData.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace PackageWizard\Installer\Data\Questions;
66

77
use PackageWizard\Installer\Data\Casts\ArrayWrapCast;
8+
use PackageWizard\Installer\Data\Casts\PlaceholderCast;
89
use PackageWizard\Installer\Data\Casts\ToStringCast;
910
use PackageWizard\Installer\Data\Casts\TranslatableCast;
1011
use PackageWizard\Installer\Data\Casts\ValidationCast;
@@ -27,7 +28,7 @@ class QuestionAskTextData extends QuestionData
2728
#[WithCast(ToStringCast::class)]
2829
public string $default = '';
2930

30-
#[WithCast(TranslatableCast::class)]
31+
#[WithCast(PlaceholderCast::class)]
3132
public string $placeholder = '';
3233

3334
public bool|string $required = true;

0 commit comments

Comments
 (0)