jeudi 9 février 2017

Custom package: autoload error for artisan route:list only, but not for laravel

I'm building a custom package for laravel 5.4 and registered it in the autoload section of my composer.json file:

"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/",
        "Me\\DevCore\\": "packages/me/devcore/src"
    }
},

(no, it isn't actually called "me"). A trait from this package is used in my controllers, and when I load up an actual route in the browser through laravel everything works fine and the trait does its magic. But when I run artisan route:list I instead get an error message like:

[Symfony\Component\Debug\Exception\FatalErrorException]  
Trait 'Me\DevCore\Controller\Helper' not found

I obviously ran a composer dump-autoload after placing my autoload rule in my composer.json file (otherwise things would break when I load them in the browser). So now I'm very confused as to why my files aren't being autoloaded for the artisan route:list command.

Almost forgot, here is the controller class that references the trait in question:

<?php
namespace Modules\Tasks\Http\Controllers;

use Illuminate\Routing\Controller;
use Modules\Tasks\Entities\Task;
use Me\DevCore\Controller\Helper;

class TasksController extends Controller
{
    use Helper;
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kXDM41
via IFTTT

Aucun commentaire:

Enregistrer un commentaire