Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
1d7e5bf
Squashed 'packages/filament-uploadcare-field/' content from commit 34…
Baspa Nov 14, 2025
da84406
Merge commit '1d7e5bf1bd435a14ec4c02ff952754bc8708c049' as 'packages/…
Baspa Nov 14, 2025
8225bb5
Squashed 'packages/uploadcare-field/' content from commit a994f38
Baspa Nov 14, 2025
7a066ee
Merge commit '8225bb50dca2401896d7d624d12bd4c1ed7de261' as 'packages/…
Baspa Nov 14, 2025
6b82969
import media package changes
Baspa Nov 14, 2025
427f843
import uploadcare-field changes
Baspa Nov 14, 2025
b5c1906
import core changes
Baspa Nov 14, 2025
882fd14
build uploadcare assets
Baspa Nov 14, 2025
873ae3e
fix icon path
Baspa Nov 14, 2025
59d077c
packages
Baspa Nov 14, 2025
b100943
Merge branch 'main' of github.com:backstagephp/cms into feat/media-op…
Baspa Nov 14, 2025
008b119
add missing files
Baspa Nov 14, 2025
78b511d
columnSpanFull for first alt
Baspa Nov 14, 2025
de30899
rename alt tag to alt text
Baspa Nov 14, 2025
b57065c
remove original filename and set filename as modal heading
Baspa Nov 14, 2025
73cae9c
add translations to the media model
Baspa Nov 14, 2025
57efa10
fix: styling
Baspa Nov 14, 2025
fc10b51
Merge branch 'main' into feat/media-optimizations
Casmo Nov 14, 2025
384b737
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Casmo Nov 14, 2025
b8c48e1
wip it
Baspa Nov 14, 2025
f60510d
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Nov 14, 2025
6e07bd5
fix: styling
Baspa Nov 14, 2025
d5ac70c
remove dupe notification
Baspa Nov 14, 2025
ac305ad
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Nov 14, 2025
a193cc3
fix: styling
Baspa Nov 14, 2025
65b4733
improve media picker
Baspa Nov 14, 2025
551aeef
media grid picker improvements
Baspa Nov 14, 2025
8972868
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Nov 14, 2025
3de54bd
fix: styling
Baspa Nov 14, 2025
f61d2d0
feat: check on file types and allow multiple
Baspa Nov 21, 2025
6738f65
fix: keyvalue nested arrays
Baspa Nov 21, 2025
0008b41
Merge branch 'main' of github.com:backstagephp/cms into feat/media-op…
Baspa Nov 21, 2025
385b06f
fix uploading files
Baspa Nov 21, 2025
ab5778b
backstage specific listmedia
Baspa Nov 21, 2025
9122184
custom uploadcare src attribute
Baspa Nov 21, 2025
2169277
fix: styling
Baspa Nov 21, 2025
90c5dec
remove code
Baspa Nov 21, 2025
17eeb8c
fix: nested array values
Baspa Nov 21, 2025
1d14138
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Nov 21, 2025
75a1a97
fix: styling
Baspa Nov 21, 2025
bce7197
fix imports
Baspa Nov 21, 2025
0b4a707
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Nov 21, 2025
f654d73
feat: add database view
Baspa Nov 21, 2025
9f9509b
fix: styling
Baspa Nov 21, 2025
69662ec
feat: add image preview in edit mode and show array values correct
Baspa Nov 21, 2025
1a53ae2
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Nov 21, 2025
3499b61
fix: translations in UC
Baspa Nov 21, 2025
4fdd644
remove hardcoded lang
Baspa Nov 21, 2025
a95060c
fix: styling
Baspa Nov 21, 2025
b4c7340
alignCenter
Baspa Nov 21, 2025
4ea7a1b
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Nov 21, 2025
4cafc9b
Merge branch 'main' into feat/media-optimizations
Baspa Nov 21, 2025
b9282c6
Merge branch 'main' of github.com:backstagephp/cms into feat/media-op…
Baspa Nov 28, 2025
1961f61
decouple Uploadcare from core packages
Baspa Nov 28, 2025
17a8fe9
fix: styling
Baspa Nov 28, 2025
6ab7b72
Merge branch 'main' of github.com:backstagephp/cms into feat/media-op…
Baspa Nov 28, 2025
25c8519
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Nov 28, 2025
262b75e
this needs testing: check if saving works correctly
Baspa Dec 1, 2025
b52cddc
feat: allow hydrating values from custom fields
Baspa Dec 8, 2025
86f360c
give custom fields priority over normal fields
Baspa Dec 8, 2025
a0c2e3c
fix handling nested fields in repeater/builder
Baspa Dec 8, 2025
21e45e1
fix: styling
Baspa Dec 8, 2025
be09513
reduce redundant code
Baspa Dec 8, 2025
d451515
wip
Baspa Dec 8, 2025
2c98611
Merge branch 'fix/hydrating-uploadcare-values' of github.com:backstag…
Baspa Dec 8, 2025
1a84dc9
fix: styling
Baspa Dec 8, 2025
7a80bac
Merge branch 'main' into fix/hydrating-uploadcare-values
Baspa Dec 8, 2025
da4afd3
return Media model
Baspa Dec 8, 2025
2f54f6c
getMimeTypeAttribute
Baspa Dec 8, 2025
c0e2c2d
fix: styling
Baspa Dec 8, 2025
582578d
cast metadata to array
Baspa Dec 9, 2025
097af51
Merge branch 'fix/hydrating-uploadcare-values' of github.com:backstag…
Baspa Dec 9, 2025
4db3143
Merge branch 'main' of github.com:backstagephp/cms into feat/media-op…
Baspa Dec 10, 2025
92289f2
fix: styling
Baspa Dec 10, 2025
7d03884
Merge branch 'fix/hydrating-uploadcare-values' of github.com:backstag…
Baspa Dec 10, 2025
b1243ee
wip
Baspa Dec 10, 2025
a5b8cd6
convert data to media_relationships
Baspa Dec 10, 2025
56571fd
relationships and hydrating
Baspa Dec 10, 2025
9992517
observer and define relation
Baspa Dec 10, 2025
5e8db10
fix: styling
Baspa Dec 10, 2025
07d6bb4
rename usages to edits
Baspa Dec 10, 2025
ef86963
load edits for media
Baspa Dec 10, 2025
9cc7b40
`getEditAttribute`
Baspa Dec 10, 2025
d1c641a
`getEditAttribute`
Baspa Dec 10, 2025
3652ab5
fix: styling
Baspa Dec 10, 2025
5ce3a62
disable future mediaPicker
Baspa Dec 10, 2025
ed428ae
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Dec 10, 2025
8eb8938
fix: styling
Baspa Dec 10, 2025
558a2ad
return relation
Baspa Dec 10, 2025
f842608
fix manoj
Baspa Dec 10, 2025
705d264
wip
Baspa Dec 10, 2025
38b45d7
remove media resource
Baspa Dec 10, 2025
ed4a902
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Dec 10, 2025
b7a4fa5
fix: styling
Baspa Dec 10, 2025
885e305
disable broken translations in edit form
Baspa Dec 10, 2025
1cab135
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Dec 10, 2025
2f371ff
fix file upload by uploadcare
Baspa Dec 10, 2025
0fef4a4
extends functionality from the media baseclass
Baspa Dec 10, 2025
de6b132
fix translations
Baspa Dec 10, 2025
0d41639
hide translate button when no openai key set
Baspa Dec 10, 2025
67f6ceb
file icons for previews
Baspa Dec 10, 2025
bb4ba5e
fix: styling
Baspa Dec 10, 2025
ed1dc57
dont encode metadata
Baspa Dec 10, 2025
f49cc85
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Dec 10, 2025
bfea87e
use correct md5 hashes for normal media and uploadcare
Baspa Dec 11, 2025
822e038
fix: styling
Baspa Dec 11, 2025
adc5d31
docs: hydrating fields
Baspa Dec 11, 2025
93b9a02
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Dec 11, 2025
6af1ee1
docs: custom mediaupload using events
Baspa Dec 11, 2025
91c5651
fix: media grid picker and cleanup Uploadcare code
Baspa Dec 11, 2025
da1c2d1
styles: darkmode issues
Baspa Dec 11, 2025
c9828a0
fix migration
Baspa Dec 12, 2025
a666ab7
wip
Baspa Dec 12, 2025
f91c2f3
fix: styling
Baspa Dec 12, 2025
019c929
fix: defining extension
Baspa Dec 12, 2025
dc8fbe5
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Dec 12, 2025
3de8ee3
fix: styling
Baspa Dec 12, 2025
7ab3919
fix: saving crop doesnt always saves cdnUrlModifiers
Baspa Dec 12, 2025
d0dc42b
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Dec 12, 2025
8684013
Merge branch 'main' of github.com:backstagephp/cms into feat/media-op…
Baspa Dec 12, 2025
4695533
fix: load values when getting field
Baspa Dec 12, 2025
155f60d
wip
Baspa Dec 12, 2025
ab58386
wip
Baspa Dec 12, 2025
20f7670
fix: styling
Baspa Dec 12, 2025
df1d9d7
wip
Baspa Dec 12, 2025
0bd7efd
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Dec 12, 2025
89cf026
fix: styling
Baspa Dec 12, 2025
6707341
fix: order of executing
Baspa Dec 12, 2025
dc6a7fe
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Dec 12, 2025
a18ba8e
fix: load site relation
Baspa Dec 12, 2025
fc61c90
fix: styling
Baspa Dec 12, 2025
387d6af
wip
Baspa Dec 12, 2025
8b7674c
Merge branch 'feat/media-optimizations' of github.com:backstagephp/cm…
Baspa Dec 12, 2025
5656a30
wip it
Baspa Dec 12, 2025
9d6c6d5
fix composer.json
Baspa Dec 12, 2025
9641504
test: trigger workflow
Baspa Dec 12, 2025
754e288
test: trigger workflow
Baspa Dec 12, 2025
43f85c4
self.version
Baspa Dec 12, 2025
64ba8cb
fix incorrect config key
Baspa Dec 12, 2025
757e08d
get nested configs
Baspa Dec 12, 2025
5867383
wip
Baspa Dec 12, 2025
4feefc7
fix phpstan issues
Baspa Dec 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"codewithdennis/filament-select-tree": "^4.0",
"filament/filament": "^4.0",
"nette/php-generator": "^4.1",
"phiki/phiki": "^2.0",
"saade/filament-adjacency-list": "^4.0",
"spatie/laravel-package-tools": "^1.18",
"spatie/once": "^3.1",
Expand Down Expand Up @@ -124,4 +125,4 @@
],
"minimum-stability": "dev",
"prefer-stable": true
}
}
73 changes: 73 additions & 0 deletions config/backstage/media.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php

use Backstage\Models\Content;
use Backstage\Models\Site;
use Backstage\Models\User;

return [
/*
|--------------------------------------------------------------------------
| File upload
|--------------------------------------------------------------------------
|
*/
'accepted_file_types' => [
'image/jpeg',
'image/png',
'image/webp',
'image/svg+xml',
'video/mp4',
'video/webm',
'audio/mpeg',
'audio/ogg',
'application/pdf',
],

'directory' => 'media',

'disk' => config('filament.filesystem_disk', 'public'),

'should_preserve_filenames' => false,

'should_register_navigation' => true,

'visibility' => 'public',

/*
|--------------------------------------------------------------------------
| Tenancy
|--------------------------------------------------------------------------
|
*/
'is_tenant_aware' => true,
'tenant_ownership_relationship_name' => 'site',
'tenant_relationship' => 'site',
'tenant_model' => Site::class,

/*
|--------------------------------------------------------------------------
| Model and resource
|--------------------------------------------------------------------------
|
*/
'model' => \Backstage\Media\Models\Media::class,

'user_model' => User::class,

'resources' => [
'label' => 'Media',
'plural_label' => 'Media',
'navigation_group' => null,
'navigation_label' => 'Media',
'navigation_icon' => 'heroicon-o-photo',
'navigation_sort' => null,
'navigation_count_badge' => false,
'resource' => \Backstage\Media\Resources\MediaResource::class,
],

'file_upload' => [
'models' => [
Content::class,
],
],
];
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ public function up(): void
->on(app(config('backstage.media.model', \Backstage\Media\Models\Media::class))->getTable())
->cascadeOnDelete();

// Polymorphic model relationship
$table->morphs('model');
// Polymorphic model relationship (String ID support)
$table->string('model_type');
$table->string('model_id', 36);
$table->index(['model_type', 'model_id']);

// Optional position for each relationship
$table->unsignedInteger('position')->nullable();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up()
{
Schema::create('translated_attributes', function (Blueprint $table) {
$table->id();
$table->string('code', 5);

$table->foreign('code')
->references('code')
->on('languages')
->onDelete('cascade');

$table->ulidMorphs('translatable');

$table->longText('attribute');
$table->longText('translated_attribute')->nullable();
$table->timestamp('translated_at')->nullable();

$table->timestamps();
$table->softDeletes();
});
}

public function down()
{
Schema::dropIfExists('translated_attributes');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up(): void
{
$model = config('backstage.media.model');
Schema::table((new $model)->getTable(), function (Blueprint $table) {
$table->text('alt')->nullable()->after('height');
});
}

public function down(): void
{
$model = config('backstage.media.model');
Schema::table((new $model)->getTable(), function (Blueprint $table) {
$table->dropColumn('alt');
});
}
};
2 changes: 1 addition & 1 deletion packages/core/config/backstage/cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Backstage\Resources\SettingResource::class,
Backstage\Resources\SiteResource::class,
Backstage\Resources\TagResource::class,
Backstage\Media\Resources\MediaResource::class,
Backstage\Resources\MediaResource::class,
// Backstage\Resources\TemplateResource::class,
Backstage\Resources\TypeResource::class,
Backstage\Resources\UserResource::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ public function up(): void
->on(app(config('backstage.media.model', \Backstage\Media\Models\Media::class))->getTable())
->cascadeOnDelete();

// Polymorphic model relationship
$table->morphs('model');
// Polymorphic model relationship (String ID support)
$table->string('model_type');
$table->string('model_id', 36);
$table->index(['model_type', 'model_id']);

// Optional position for each relationship
$table->unsignedInteger('position')->nullable();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up()
{
if (Schema::hasTable('translated_attributes')) {
return;
}

Schema::create('translated_attributes', function (Blueprint $table) {
$table->id();
$table->string('code', 5);

$table->foreign('code')
->references('code')
->on('languages')
->onDelete('cascade');

$table->ulidMorphs('translatable');

$table->longText('attribute');
$table->longText('translated_attribute')->nullable();
$table->timestamp('translated_at')->nullable();

$table->timestamps();
$table->softDeletes();
});
}

public function down()
{
Schema::dropIfExists('translated_attributes');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up(): void
{
$model = config('backstage.media.model');
Schema::table((new $model)->getTable(), function (Blueprint $table) {
$table->text('alt')->nullable()->after('height');
});
}

public function down(): void
{
$model = config('backstage.media.model');
Schema::table((new $model)->getTable(), function (Blueprint $table) {
$table->dropColumn('alt');
});
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up(): void
{
Schema::table('media_relationships', function (Blueprint $table) {
// Change model_id to string to support IDs, ULIDs, and UUIDs (max 36 chars)
$table->string('model_id', 36)->change();
$table->string('model_type')->change();
});
}

public function down(): void
{
Schema::table('media_relationships', function (Blueprint $table) {
// Revert to typical big integer if needed (unsafe if data exists)
// $table->unsignedBigInteger('model_id')->change();
});
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up(): void
{
// 1. Try to drop foreign key (might fail if already dropped)
try {
Schema::table('media_relationships', function (Blueprint $table) {
$table->dropForeign(['media_ulid']);
});
} catch (\Illuminate\Database\QueryException $e) {
// Ignore if foreign key does not exist
}

// 2. Try to drop unique index (might fail if already dropped)
try {
Schema::table('media_relationships', function (Blueprint $table) {
$table->dropUnique(['media_ulid', 'model_type', 'model_id']);
});
} catch (\Illuminate\Database\QueryException $e) {
// Ignore if index does not exist
}

// 3. Try to add new index (might fail if already exists)
try {
Schema::table('media_relationships', function (Blueprint $table) {
$table->index(['model_type', 'model_id', 'position']);
});
} catch (\Illuminate\Database\QueryException $e) {
// Ignore if index already exists
}

// 4. Re-add foreign key (using safe 'foreign' method)
Schema::table('media_relationships', function (Blueprint $table) {
// We use a separate call here to ensure we don't catch unexpected errors in the definition
// But we might want to check if it exists?
// Generically adding a FK usually fails if it exists with same name.
// Since we know we tried to drop it in step 1, this should be safe unless step 1 failed unrelatedly.
// However, to be extra safe against "Constraint already exists":
try {
$table->foreign('media_ulid')
->references('ulid')
->on(app(config('backstage.media.model', \Backstage\Media\Models\Media::class))->getTable())
->cascadeOnDelete();
} catch (\Illuminate\Database\QueryException $e) {
// assume it exists if it fails
}
});
}

public function down(): void
{
Schema::table('media_relationships', function (Blueprint $table) {
$table->dropIndex(['model_type', 'model_id', 'position']);
$table->unique(['media_ulid', 'model_type', 'model_id']);
});
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up()
{
Schema::table('translated_attributes', function (Blueprint $table) {
$table->string('translatable_id', 36)->change();
$table->string('translatable_type', 36)->change();
});
}

public function down()
{
Schema::dropIfExists('translated_attributes');
}
};
Loading