Move CollectionExtension
This commit is contained in:
parent
820a725517
commit
194f1f9c14
|
@ -2,13 +2,8 @@
|
||||||
|
|
||||||
namespace Zoomyboy\MedialibraryHelper;
|
namespace Zoomyboy\MedialibraryHelper;
|
||||||
|
|
||||||
use Spatie\MediaLibrary\MediaCollections\MediaCollection;
|
|
||||||
|
|
||||||
class CollectionExtension
|
class CollectionExtension
|
||||||
{
|
{
|
||||||
public function boot(): void
|
|
||||||
{
|
|
||||||
MediaCollection::mixin(new class() {
|
|
||||||
public function forceFileName()
|
public function forceFileName()
|
||||||
{
|
{
|
||||||
return fn ($callback) => $this->registerCustomCallback('forceFileName', $callback);
|
return fn ($callback) => $this->registerCustomCallback('forceFileName', $callback);
|
||||||
|
@ -92,6 +87,4 @@ class CollectionExtension
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace Zoomyboy\MedialibraryHelper;
|
||||||
|
|
||||||
use Illuminate\Routing\Router;
|
use Illuminate\Routing\Router;
|
||||||
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
|
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
|
||||||
|
use Spatie\MediaLibrary\MediaCollections\MediaCollection;
|
||||||
|
|
||||||
class ServiceProvider extends BaseServiceProvider
|
class ServiceProvider extends BaseServiceProvider
|
||||||
{
|
{
|
||||||
|
@ -23,7 +24,8 @@ class ServiceProvider extends BaseServiceProvider
|
||||||
$router->patch('mediaupload/{media}', [MediaController::class, 'update'])->name('media.update');
|
$router->patch('mediaupload/{media}', [MediaController::class, 'update'])->name('media.update');
|
||||||
});
|
});
|
||||||
|
|
||||||
app(CollectionExtension::class)->boot();
|
MediaCollection::mixin(app(CollectionExtension::class));
|
||||||
|
// app(CollectionExtension::class)->boot();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue