saleem-hadad / larecipe

✏️ Write and ship beautiful documentation with your Laravel applications using MarkDown
https://larecipe.saleem.dev/
MIT License
2.4k stars 264 forks source link

Empty root URL segment doesn't seem to work with V2 #141

Closed mattias-persson closed 4 years ago

mattias-persson commented 5 years ago

Describe the bug I've used version 1.3 of the package for a long time on https://laravel-shopr.happypixels.se, where I've set the docs.route key in the config to '', which removes the /docs segment from the URL. Upgrading to version 2 of this package makes this setup crash with a Route [larecipe.index] not defined. error. If I add '/docs' to the config value it works.

To Reproduce

  1. Install the package.
  2. In config/larecipe, set the 'route' key to ''.
  3. Reload the page.

Expected behavior The docs should be presented without a '/docs'-prefix.

Desktop (please complete the following information):

saleem-hadad commented 5 years ago

Hi @mattias-persson thanks for sharing I'll look at it now

saleem-hadad commented 5 years ago

I've tried it now, it's working :/ can you try the route to be '/' instead of empty string ''?

mattias-persson commented 5 years ago

@saleem-hadad Thanks for looking! That's weird, maybe some issue occurred when I tried upgrading the package from v1.3. I'll try setting up a new Laravel-installation later and see if I can get it working.

mattias-persson commented 5 years ago

@saleem-hadad Just tried again with a new installation of Laravel (5.8) and Larecipe (^2.1). Still have the same issue, when setting the docs.route config key to '' or '/' I get the following error: Route [larecipe.index] not defined..

Seems to be caused by DocumentationRepository.php:30, $this->docsRoute = route('larecipe.index');.

The exact steps:

  1. Install Laravel
  2. composer require binarytorch/larecipe
  3. php artisan larecipe:install
  4. Modify the docs part of config/larecipe.php to look like this:
    'docs'        => [
    'route'   => '', // same result with or '/'
    'path'    => '/resources/docs',
    'landing' => 'overview',
    ],
  5. Visit yoursite.test/1.0, which gives me the error
saleem-hadad commented 4 years ago

I think this got a fix in ^2.2 please confirm