mardi 25 septembre 2018

Dynamic route url change is not reflecting in laravel package

I am creating a package which gives a config file to customize the route url which it will add, I can see config file values in the controller, but same config('app_settings.url') is coming as null in pakacge/src/routes/web.php

Route::get(config('app_settings.url'), 'SomeController')

my tests are also giving 404 and app_settings config change is not getting picked by route.

function it_can_change_route_url_by_config() {
  // this should be default url
  $this->get('settings')
    ->assertStatus(200);

  // change the route url
  config()->set('app_settings.url', '/app_settings');

  $this->get('app_settings')
    ->assertStatus(200);

  $this->get('settings')
    ->assertStatus(400);
}

app_setting.php

return [
    'url' => 'settings',
    'middleware' => []
];

Please help How I can give the option to change the route url from config.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire