Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
449 views
in Technique[技术] by (71.8m points)

php - Laravel Lumen (5.7.8): Unable to inject LogManager - Unresolvable dependency resolving

I'm trying to inject LogManager into my Lumen's controller but I'm getting:

{
    "message": "Unresolvable dependency resolving [Parameter #0 [ <required> $app ]] in class Illuminate\Log\LogManager",
    "status_code": 500
}

Injecting DatabaseManager works with no issues whatsoever.

class PackageController extends ApiController
{
    private $databaseManager;
    private $logManager;
    private $packageService;

    public function __construct(
        DatabaseManager $databaseManager,
        LogManager $logManager,
        PackageServiceInterface $packageService
    ) {
        $this->databaseManager = $databaseManager; <- works
        $this->logManager = $logManager; <- error
        $this->packageService = $packageService; <- works
    }

Do I have to add something into bootstrap/app.php for logs? I don't want to use facades in my controllers.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...