Skip to content

Commit aaef6a8

Browse files
author
Backstage
committed
fix: users and announcement issues (#8)
1 parent e1e7f29 commit aaef6a8

22 files changed

+46
-1183
lines changed

.github/workflows/phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ jobs:
2323
uses: ramsey/composer-install@v3
2424

2525
- name: Run PHPStan
26-
run: ./vendor/bin/phpstan --error-format=github
26+
run: ./vendor/bin/phpstan --error-format=github

.github/workflows/run-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: run-tests
32

43
on:
@@ -31,7 +30,7 @@ jobs:
3130
uses: shivammathur/setup-php@v2
3231
with:
3332
php-version: ${{ matrix.php }}
34-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo, sockets
33+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
3534
coverage: none
3635

3736
- name: Setup problem matchers

README.md

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ You can publish and run the migrations with:
2525

2626
```bash
2727
php artisan vendor:publish --tag="media-migrations"
28-
php artisan vendor:publish --provider="Backstage\Translations\Laravel\TranslationServiceProvider"
29-
php artisan migrate
3028
```
3129

3230
> [!NOTE]
@@ -210,41 +208,6 @@ protected function mutateFormDataBeforeSave(array $data): array
210208
}
211209
```
212210

213-
### Handling File Uploads via Events
214-
215-
You can listen to the `Backstage\Media\Events\MediaUploading` event to handle file uploads via custom providers (like Uploadcare) or to perform file processing before saving.
216-
217-
If your listener returns an instance of `Backstage\Media\Models\Media`, the default file handling (storing in local/S3 disk) will be skipped.
218-
219-
```php
220-
use Backstage\Media\Events\MediaUploading;
221-
use Backstage\Media\Models\Media;
222-
223-
class CreateMediaFromUploadcare
224-
{
225-
public function handle(MediaUploading $event): ?Media
226-
{
227-
$file = $event->file;
228-
229-
// ... upload logic ...
230-
231-
return $media; // Return Media model to stop default processing
232-
}
233-
}
234-
```
235-
236-
Register your listener in your `ServiceProvider`:
237-
238-
```php
239-
use Illuminate\Support\Facades\Event;
240-
use Backstage\Media\Events\MediaUploading;
241-
242-
Event::listen(
243-
MediaUploading::class,
244-
CreateMediaFromUploadcare::class,
245-
);
246-
```
247-
248211
## Testing
249212

250213
```bash
@@ -265,9 +228,9 @@ Please review [our security policy](../../security/policy) on how to report secu
265228

266229
## Credits
267230

268-
- [Baspa](https://github.com/vormkracht10)
269-
- [All Contributors](../../contributors)
231+
- [Baspa](https://github.com/vormkracht10)
232+
- [All Contributors](../../contributors)
270233

271234
## License
272235

273-
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
236+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

composer.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@
2121
],
2222
"require": {
2323
"php": "^8.3",
24-
"backstage/fields": "self.version",
25-
"backstage/laravel-translations": "self.version",
2624
"filament/filament": "^4.0",
27-
"phiki/phiki": "^2.0",
28-
"spatie/laravel-package-tools": "^1.15.0"
25+
"spatie/laravel-package-tools": "^1.15.0",
26+
"backstage/fields": "self.version"
2927
},
3028
"require-dev": {
3129
"nunomaduro/larastan": "^2.0.1|^3.0",
@@ -61,7 +59,6 @@
6159
"sort-packages": true,
6260
"allow-plugins": {
6361
"pestphp/pest-plugin": true,
64-
"php-http/discovery": true,
6562
"phpstan/extension-installer": true
6663
}
6764
},
@@ -75,6 +72,8 @@
7572
}
7673
}
7774
},
75+
"repositories": {
76+
},
7877
"minimum-stability": "dev",
7978
"prefer-stable": true
80-
}
79+
}

config/backstage/media.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
'directory' => 'media',
2323

24-
'disk' => config('filesystems.default', 'public'),
24+
'disk' => env('FILAMENT_FILESYSTEM_DISK', 'public'),
2525

2626
'should_preserve_filenames' => false,
2727

database/migrations/add_alt_column_to_media_table.php.stub

Lines changed: 0 additions & 20 deletions
This file was deleted.

database/migrations/create_media_relationships_table.php.stub

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ return new class extends Migration
1717
->on(app(config('backstage.media.model', \Backstage\Media\Models\Media::class))->getTable())
1818
->cascadeOnDelete();
1919

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

2523
// Optional position for each relationship
2624
$table->unsignedInteger('position')->nullable();

database/migrations/make_media_relationships_model_id_string.php.stub

Lines changed: 0 additions & 25 deletions
This file was deleted.

phpstan.neon.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ parameters:
1010
tmpDir: build/phpstan
1111
checkOctaneCompatibility: true
1212
checkModelProperties: true
13-
ignoreErrors:
14-
- identifier: trait.unused
13+
checkMissingIterableValueType: false
14+

src/Concerns/HasMedia.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
use Illuminate\Database\Eloquent\Relations\MorphToMany;
77
use Illuminate\Support\Collection;
88

9-
/**
10-
* @mixin Model
11-
*/
129
trait HasMedia
1310
{
1411
/**

0 commit comments

Comments
 (0)