laravel-route-attributes icon indicating copy to clipboard operation
laravel-route-attributes copied to clipboard

Adding domain with Resource

Open lloricode opened this issue 7 months ago • 0 comments

Hi! We are having an issue when adding domain routes using a Resource.

php: 8.3.8 laravel: 11.13 spatie/laravel-route-attributes: 1.22.1

controller:

#[Resource('test')]
class TestResourceController
{

config: route-attributes

'directories' => [
        app_path('Http/Controllers') => [
            'domain' => env('APP_URL')
        ],

console with error:

lloricode@lloricode:~/Downloads/laravel-11.x$ php artisan route:list

   TypeError 

  preg_match_all(): Argument #2 ($subject) must be of type string, array given

  at vendor/laravel/framework/src/Illuminate/Routing/RouteUri.php:42
     38▕      * @return static
     39▕      */
     40▕     public static function parse($uri)
     41▕     {
  ➜  42▕         preg_match_all('/\{([\w\:]+?)\??\}/', $uri, $matches);
     43▕ 
     44▕         $bindingFields = [];
     45▕ 
     46▕         foreach ($matches[0] as $match) {

      +34 vendor frames 

  35  [internal]:0
      Illuminate\Foundation\Application::Illuminate\Foundation\{closure}()
      +6 vendor frames 

  42  artisan:13
      Illuminate\Foundation\Application::handleCommand()

here a fresh laravel with just reproduce an issue repo commit

Regards,

lloricode avatar Jun 30 '24 06:06 lloricode