Skip to content
Draft

2.x #36

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
b2eab60
feat: media optimizations (#7)
Baspa Dec 12, 2025
804afba
fix: nested arrays may not be passed to `whereIn`
Baspa Dec 12, 2025
abeca61
fix: styling
Baspa Dec 12, 2025
5b62dfe
fix: reordering builders
Baspa Dec 16, 2025
7c636c4
Merge branch 'main' into 2.x
Baspa Dec 17, 2025
78bf97b
fix: repair `uc` relationships, improve retreiving uuids
Baspa Dec 17, 2025
ea734bc
Merge branch 'main' of github.com:backstagephp/cms into 2.x
Baspa Dec 19, 2025
3a21def
fix: styling
Baspa Dec 19, 2025
e96cfc7
Merge branch 'main' of github.com:backstagephp/cms into 2.x
Baspa Dec 19, 2025
bc3c250
fix: saving and reading Uploadccare metadata
Baspa Dec 22, 2025
c320dd3
fix: styling
Baspa Dec 22, 2025
bf05e31
feat: make user email unique
Baspa Dec 29, 2025
6759638
fix: force casting to `string` to prevent `array` error
Baspa Dec 29, 2025
d2da3db
feat: temporarily disable translation strings
Baspa Dec 29, 2025
d4fbeb7
fix: hydrate differently for front- and backend
Baspa Dec 31, 2025
b718a86
wip
Baspa Dec 31, 2025
02ac164
wip
Baspa Dec 31, 2025
d3e413a
fix: refreshing and persisting form states (create & create another)
Baspa Jan 2, 2026
abf545c
fix: applying modifiers
Baspa Jan 2, 2026
6536b43
fix: styling
Baspa Jan 2, 2026
656d7cb
fix: hydrated values and relation fields
Baspa Jan 2, 2026
70c5c91
Merge branch '2.x' of github.com:backstagephp/cms into 2.x
Baspa Jan 2, 2026
6146a7b
fix: styling
Baspa Jan 2, 2026
4fb5496
Feature/2.x demo release (#37)
Casmo Jan 2, 2026
61003b9
Correct file paths
Casmo Jan 2, 2026
222208e
fix: styling
Casmo Jan 2, 2026
9478981
wip
Baspa Jan 5, 2026
4f634ab
fix: loading crops
Baspa Jan 5, 2026
8d4c920
wip
Baspa Jan 5, 2026
5cf1f57
fix: clearing files on "create & create another"
Baspa Jan 5, 2026
3bf40af
Merge branch '2.x' of github.com:backstagephp/cms into 2.x
Baspa Jan 5, 2026
964ed89
fix: styling
Baspa Jan 5, 2026
806cdbc
remove logging
Baspa Jan 5, 2026
09eba9b
Merge branch '2.x' of github.com:backstagephp/cms into 2.x
Baspa Jan 5, 2026
ae81c3e
fix: attach media files to duplicated content
Baspa Jan 6, 2026
68cb7c6
fix: accidental added code block
Baspa Jan 6, 2026
f429ac8
fix: styling
Baspa Jan 6, 2026
85c85ec
Stacks instead of slots
Ynitial Jan 7, 2026
26f7986
Undo block stacks, use slots instead
Ynitial Jan 7, 2026
2e22f94
Add helpers.php
Casmo Jan 9, 2026
0ba5747
fix: styling
Casmo Jan 9, 2026
6ff4b30
Upgrade to laravel 12.x
Casmo Jan 9, 2026
8922aca
Merge branch '2.x' of github.com:backstagephp/cms into 2.x
Casmo Jan 9, 2026
3b26427
Remove console check
Casmo Jan 9, 2026
5527ba9
Fix setup
Casmo Jan 9, 2026
d931ce5
Add hydrate for field interface
Casmo Jan 9, 2026
a1edae7
fix: styling
Casmo Jan 9, 2026
78061d7
Media uploaded eventfor uploadcare
Casmo Jan 12, 2026
f6b28b4
Merge branch '2.x' of github.com:backstagephp/cms into 2.x
Casmo Jan 12, 2026
d367133
fix: styling
Casmo Jan 12, 2026
ac23698
Remove helpers
Casmo Jan 12, 2026
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
2 changes: 1 addition & 1 deletion .github/workflows/setup-in-laravel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ jobs:
composer config minimum-stability dev
git clone --branch ${{ steps.extract_branch.outputs.branch }} https://github.com/backstagephp/cms.git
composer config repositories.backstage-packages path "cms/packages/*"
composer require backstage/cms:dev-${{ steps.extract_branch.outputs.branch }}
composer require backstage/cms:${{ steps.extract_branch.outputs.branch }}-dev
composer update --no-interaction
php artisan backstage:install
9 changes: 6 additions & 3 deletions 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 All @@ -56,7 +57,7 @@
"laravel/pint": "^1.14",
"nunomaduro/collision": "^8.1.1||^7.10.0",
"larastan/larastan": "^3.7",
"orchestra/testbench": "^9.0.0||^8.22.0",
"orchestra/testbench": "^10.0",
"pestphp/pest": "^4.1",
"pestphp/pest-plugin-arch": "^4.0",
"pestphp/pest-plugin-laravel": "^4.0",
Expand All @@ -73,6 +74,7 @@
"Backstage\\Fields\\": "packages/fields/src/",
"Backstage\\Fields\\Database\\Factories\\": "packages/fields/database/factories/",
"Backstage\\Media\\": "packages/media/src/",
"Backstage\\UploadcareField\\": "packages/uploadcare-field/src/",
"Backstage\\Database\\Factories\\": "database/factories/",
"Backstage\\Database\\Seeders\\": "database/seeders/"
},
Expand All @@ -82,7 +84,8 @@
},
"autoload-dev": {
"psr-4": {
"Backstage\\Tests\\": "tests/"
"Backstage\\Tests\\": "tests/",
"Backstage\\UploadcareField\\Tests\\": "packages/uploadcare-field/tests/"
}
},
"scripts": {
Expand Down Expand Up @@ -124,4 +127,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');
});
}
};
43 changes: 0 additions & 43 deletions database/seeders/BackstageSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Backstage\Models\Language;
use Backstage\Models\Site;
use Backstage\Models\Type;
use Backstage\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;

Expand Down Expand Up @@ -173,47 +172,5 @@ public function run(): void
(string) Str::uuid() => ['type' => 'form', 'data' => ['slug' => 'contact']],
]),
]), 'values')->create();

User::factory([
'name' => 'Mark',
'email' => '[email protected]',
'password' => '[email protected]',
])->create();

User::factory([
'name' => 'Rob',
'email' => '[email protected]',
'password' => '[email protected]',
])->create();

User::factory([
'name' => 'Mathieu',
'email' => '[email protected]',
'password' => '[email protected]',
])->create();

User::factory([
'name' => 'Bas',
'email' => '[email protected]',
'password' => '[email protected]',
])->create();

User::factory([
'name' => 'Yoni',
'email' => '[email protected]',
'password' => '[email protected]',
])->create();

User::factory([
'name' => 'Patrick',
'email' => '[email protected]',
'password' => '[email protected]',
])->create();

User::factory([
'name' => 'Sandro',
'email' => '[email protected]',
'password' => '[email protected]',
])->create();
}
}
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();
});
}
};
Loading