Closed route33 closed 2 years ago
How are you extending this exactly? This wasn't really a supported use case.
I don't think the you have the options to change any configuration at runtime right? So you're just replacing the CorsService directly?
I could release https://github.com/fruitcake/laravel-cors/pull/558 as v2.2.0 and tagged the current 2.1 as 3.0 🤔
use Fruitcake\Cors\CorsServiceProvider as ParentCorsServiceProvider;
use Asm89\Stack\CorsService;
class CorsServiceProvider extends ParentCorsServiceProvider
{
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->mergeConfigFrom($this->configPath(), 'cors');
$this->app->scoped(CorsService::class, function () {
return new CorsService($this->customCorsOptions());
});
}
/**
* Get options for CorsService
*
* @return array
*/
protected function customCorsOptions(): array
{
$options = $this->corsOptions();
$options['allowedOrigins'] = static::allowedOrigins();
return $options;
}
protected static function allowedOrigins(): array
{
$hosts = Cache::rememberForever('sites', function () {
...
});
return $hosts;
}
}
I've tagged 2.2.0 with the original namespace. Will prepare 3.x with the new one.
@barryvdh From composer outdated
- major release available - update possible,
I see there's a new mayor release of fruitcake/laravel-cors
.
I am using Laravel 9. Is the v.3.0.0 supported?
If so, How do I upgrade it?
With Laravel 9, you can use the built in CORS, see Laravel/laravel
The upgrade from v2.0.5 to v2.1.0 is a BC for users that call Asm89\Stack\CorsService dependency, for custom/dynamic settings.
This change should have been marked as major.
Laravel: 8.83.1 FruitCake: 2.1.0 PHP: 8.1.2