Skip to content

Commit 7e66814

Browse files
author
Backstage
committed
Add Filament mails to mono split
1 parent 052b753 commit 7e66814

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

database/migrations/2025_08_08_000000_fix_uploadcare_double_encoded_json.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ private function decodeAllJsonStrings($data, $path = '')
1313
{
1414
if (is_array($data)) {
1515
foreach ($data as $key => $value) {
16-
$currentPath = $path === '' ? $key : $path.'.'.$key;
16+
$currentPath = $path === '' ? $key : $path . '.' . $key;
1717
if (is_string($value)) {
1818
$decoded = $value;
1919
$decodeCount = 0;

src/Listeners/CreateMediaFromUploadcare.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private function addTenantToMediaData(array $mediaData): array
138138
}
139139

140140
$tenantRelationship = config('backstage.media.tenant_relationship', 'site');
141-
$tenantField = $tenantRelationship.'_ulid';
141+
$tenantField = $tenantRelationship . '_ulid';
142142
$tenantUlid = $tenant->ulid ?? (method_exists($tenant, 'getKey') ? $tenant->getKey() : ($tenant->id ?? null));
143143

144144
if ($tenantUlid) {
@@ -160,7 +160,7 @@ private function addTenantToSearchCriteria(array $searchCriteria): array
160160
}
161161

162162
$tenantRelationship = config('backstage.media.tenant_relationship', 'site');
163-
$tenantField = $tenantRelationship.'_ulid';
163+
$tenantField = $tenantRelationship . '_ulid';
164164
$tenantUlid = $tenant->ulid ?? (method_exists($tenant, 'getKey') ? $tenant->getKey() : ($tenant->id ?? null));
165165

166166
if ($tenantUlid) {

src/Livewire/MediaGridPicker.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function mediaItems(): LengthAwarePaginator
4646

4747
// Apply search filter
4848
if (! empty($this->search)) {
49-
$query->where('original_filename', 'like', '%'.$this->search.'%');
49+
$query->where('original_filename', 'like', '%' . $this->search . '%');
5050
}
5151

5252
// Apply accepted file types filter at query level
@@ -56,7 +56,7 @@ public function mediaItems(): LengthAwarePaginator
5656
// Handle wildcard patterns like "image/*"
5757
if (str_ends_with($acceptedType, '/*')) {
5858
$baseType = substr($acceptedType, 0, -2);
59-
$q->orWhere('mime_type', 'like', $baseType.'/%');
59+
$q->orWhere('mime_type', 'like', $baseType . '/%');
6060
}
6161
// Handle exact matches
6262
else {
@@ -147,7 +147,7 @@ private function matchesAcceptedFileTypes(?string $mimeType): bool
147147
// Handle wildcard patterns like "image/*"
148148
if (str_ends_with($acceptedType, '/*')) {
149149
$baseType = substr($acceptedType, 0, -2);
150-
if (str_starts_with($mimeType, $baseType.'/')) {
150+
if (str_starts_with($mimeType, $baseType . '/')) {
151151
return true;
152152
}
153153
}

src/Uploadcare.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public static function make(string $name, Field $field): Input
222222
if ($uuid || $cdnUrl) {
223223
$fileData = [
224224
'uuid' => $uuid ?? self::extractUuidFromString($cdnUrl ?? ''),
225-
'cdnUrl' => $cdnUrl ?? ($uuid ? 'https://ucarecdn.com/'.$uuid.'/' : null),
225+
'cdnUrl' => $cdnUrl ?? ($uuid ? 'https://ucarecdn.com/' . $uuid . '/' : null),
226226
'original_filename' => $filename,
227227
'name' => $filename,
228228
];
@@ -599,7 +599,7 @@ private static function extractMediaUrls(array $mediaUlids, bool $withMetadata =
599599

600600
// Fallback for older records: construct a default Uploadcare URL if we only have a UUID.
601601
if (! $cdnUrl && $uuid) {
602-
$cdnUrl = 'https://ucarecdn.com/'.$uuid.'/';
602+
$cdnUrl = 'https://ucarecdn.com/' . $uuid . '/';
603603
}
604604

605605
if (! $cdnUrl || ! filter_var($cdnUrl, FILTER_VALIDATE_URL)) {
@@ -882,7 +882,7 @@ private static function resolveCdnUrl(mixed $uuid): ?string
882882
$fileUuid = $metadata['uuid'] ?? ($metadata['fileInfo']['uuid'] ?? null) ?? self::extractUuidFromString((string) ($media->filename ?? ''));
883883

884884
if (! $cdnUrl && $fileUuid) {
885-
$cdnUrl = 'https://ucarecdn.com/'.$fileUuid.'/';
885+
$cdnUrl = 'https://ucarecdn.com/' . $fileUuid . '/';
886886
}
887887

888888
return is_string($cdnUrl) && filter_var($cdnUrl, FILTER_VALIDATE_URL) ? $cdnUrl : null;
@@ -895,14 +895,14 @@ private static function resolveCdnUrl(mixed $uuid): ?string
895895
$mediaModel = self::getMediaModel();
896896

897897
$media = $mediaModel::where('filename', $uuid)
898-
->orWhere('metadata->cdnUrl', 'like', '%'.$uuid.'%')
898+
->orWhere('metadata->cdnUrl', 'like', '%' . $uuid . '%')
899899
->first();
900900

901901
if ($media && isset($media->metadata['cdnUrl'])) {
902902
return $media->metadata['cdnUrl'];
903903
}
904904

905-
return 'https://ucarecdn.com/'.$uuid.'/';
905+
return 'https://ucarecdn.com/' . $uuid . '/';
906906
}
907907

908908
private static function isValidCdnUrl(string $url): bool
@@ -1098,7 +1098,7 @@ public function hydrate(mixed $value, ?Model $model = null): mixed
10981098
return $value;
10991099
}
11001100

1101-
public static function mapMediaToValue(mixed $media): array|string
1101+
public static function mapMediaToValue(mixed $media): array | string
11021102
{
11031103
if (! $media instanceof Model && ! is_array($media)) {
11041104
return is_string($media) ? $media : [];
@@ -1157,7 +1157,7 @@ public static function mapMediaToValue(mixed $media): array|string
11571157
}
11581158

11591159
// Ensure cdnUrl includes modifiers
1160-
$data['cdnUrl'] = rtrim($data['cdnUrl'], '/').'/'.$modifiers;
1160+
$data['cdnUrl'] = rtrim($data['cdnUrl'], '/') . '/' . $modifiers;
11611161
if (! str_ends_with($data['cdnUrl'], '/')) {
11621162
$data['cdnUrl'] .= '/';
11631163
}
@@ -1185,7 +1185,7 @@ private static function hydrateFromModel(?Model $model, mixed $value = null, boo
11851185

11861186
if (! empty($ulids)) {
11871187
$mediaQuery->whereIn('media_ulid', $ulids)
1188-
->orderByRaw('FIELD(media_ulid, '.implode(',', array_fill(0, count($ulids), '?')).')', $ulids);
1188+
->orderByRaw('FIELD(media_ulid, ' . implode(',', array_fill(0, count($ulids), '?')) . ')', $ulids);
11891189
}
11901190

11911191
$media = $mediaQuery->get()->unique('ulid');

src/UploadcareFieldServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function configurePackage(Package $package): void
2525
public function packageBooted(): void
2626
{
2727
FilamentAsset::register([
28-
Css::make('uploadcare-field', __DIR__.'/../resources/dist/uploadcare-field.css'),
28+
Css::make('uploadcare-field', __DIR__ . '/../resources/dist/uploadcare-field.css'),
2929
], 'backstage/uploadcare-field');
3030

3131
\Illuminate\Support\Facades\Event::listen(
@@ -40,7 +40,7 @@ public function packageBooted(): void
4040

4141
public function bootingPackage(): void
4242
{
43-
$this->loadViewsFrom(__DIR__.'/../resources/views', 'backstage-uploadcare-field');
43+
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'backstage-uploadcare-field');
4444

4545
// Register Media src resolver
4646
\Backstage\Media\Models\Media::resolveSrcUsing(function ($media) {

tests/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ protected function setUp(): void
1313
parent::setUp();
1414

1515
Factory::guessFactoryNamesUsing(
16-
fn (string $modelName) => 'Backstage\\UploadcareField\\Database\\Factories\\'.class_basename($modelName).'Factory'
16+
fn (string $modelName) => 'Backstage\\UploadcareField\\Database\\Factories\\' . class_basename($modelName) . 'Factory'
1717
);
1818
}
1919

0 commit comments

Comments
 (0)