{"action":"created","issue":{"url":"https://api.github.com/repos/spatie/laravel-medialibrary/issues/1203","repository_url":"https://api.github.com/repos/spatie/laravel-medialibrary","labels_url":"https://api.github.com/repos/spatie/laravel-medialibrary/issues/1203/labels{/name}","comments_url":"https://api.github.com/repos/spatie/laravel-medialibrary/issues/1203/comments","events_url":"https://api.github.com/repos/spatie/laravel-medialibrary/issues/1203/events","html_url":"https://github.com/spatie/laravel-medialibrary/issues/1203","id":348643430,"node_id":"MDU6SXNzdWUzNDg2NDM0MzA=","number":1203,"title":"Class App\\Generators\\CustomPathGenerator doesn't exist","user":{"login":"riseoflex88","id":12728772,"node_id":"MDQ6VXNlcjEyNzI4Nzcy","avatar_url":"https://avatars2.githubusercontent.com/u/12728772?v=4","gravatar_id":"","url":"https://api.github.com/users/riseoflex88","html_url":"https://github.com/riseoflex88","followers_url":"https://api.github.com/users/riseoflex88/followers","following_url":"https://api.github.com/users/riseoflex88/following{/other_user}","gists_url":"https://api.github.com/users/riseoflex88/gists{/gist_id}","starred_url":"https://api.github.com/users/riseoflex88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riseoflex88/subscriptions","organizations_url":"https://api.github.com/users/riseoflex88/orgs","repos_url":"https://api.github.com/users/riseoflex88/repos","events_url":"https://api.github.com/users/riseoflex88/events{/privacy}","received_events_url":"https://api.github.com/users/riseoflex88/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-08T09:21:32Z","updated_at":"2018-08-08T09:34:22Z","closed_at":null,"author_association":"NONE","body":"I'm getting the error `Class App\\Generators\\CustomPathGenerator doesn't exist` and have been stumped with various iterations of this for the last day. The docs almost oversimplify this in their explaination so I'm really struggling to work out where I've gone wrong since the example given is almost identical to mine. \r\n\r\nconfig/medialibrary.php contains: \r\n`'path_generator' => App\\Generators\\CustomPathGenerator::class,`\r\n\r\n\r\napp/Generators/CustomPathGenerator.php contains: \r\n```\r\n<?php\r\nnamespace App\\Generators\\CustomPathGenerator;\r\n\r\nuse Spatie\\MediaLibrary\\Models\\Media;\r\nuse Spatie\\MediaLibrary\\PathGenerator\\PathGenerator;\r\n\r\nclass CustomPathGenerator implements PathGenerator\r\n{\r\n\r\n    public function getPath(Media $media): string\r\n    {\r\n        return md5($media->id).'/';\r\n    }\r\n\r\n    public function getPathForConversions(Media $media): string\r\n    {\r\n        return $this->getBasePath($media).'/conversions/';\r\n    }\r\n\r\n    public function getPathForResponsiveImages(Media $media): string\r\n    {\r\n        return $this->getBasePath($media).'/responsive-images/';\r\n    }\r\n\r\n}\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/spatie/laravel-medialibrary/issues/comments/411346733","html_url":"https://github.com/spatie/laravel-medialibrary/issues/1203#issuecomment-411346733","issue_url":"https://api.github.com/repos/spatie/laravel-medialibrary/issues/1203","id":411346733,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMTM0NjczMw==","user":{"login":"riseoflex88","id":12728772,"node_id":"MDQ6VXNlcjEyNzI4Nzcy","avatar_url":"https://avatars2.githubusercontent.com/u/12728772?v=4","gravatar_id":"","url":"https://api.github.com/users/riseoflex88","html_url":"https://github.com/riseoflex88","followers_url":"https://api.github.com/users/riseoflex88/followers","following_url":"https://api.github.com/users/riseoflex88/following{/other_user}","gists_url":"https://api.github.com/users/riseoflex88/gists{/gist_id}","starred_url":"https://api.github.com/users/riseoflex88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riseoflex88/subscriptions","organizations_url":"https://api.github.com/users/riseoflex88/orgs","repos_url":"https://api.github.com/users/riseoflex88/repos","events_url":"https://api.github.com/users/riseoflex88/events{/privacy}","received_events_url":"https://api.github.com/users/riseoflex88/received_events","type":"User","site_admin":false},"created_at":"2018-08-08T09:34:22Z","updated_at":"2018-08-08T09:34:22Z","author_association":"NONE","body":"Damn the answer was simple. My lack of understanding of php namespaces bit me in the arse here.\r\n\r\nThe namespace declared at the top of the file needs to be the name of the parent folder, not the name of the class as I was doing. \r\n\r\nSo the top namespace should just be `namespace App\\Generators`\r\n\r\nSo when this is used in config/medialibary, it's using the 'App\\Generators' structure, and looking for a class named 'CustomPathGenerator'"}}
{"actor":{"display_login":"riseoflex88"}}