当我尝试在Laravel 5.4 *上实例化Soften\Indipay
时收到此消息
github
构建[\ Softon \ Indipay \ Indipay]时,目标[Softon \ Indipay \ Gateways \ PaymentGatewayInterface]无法实例化。
我在app/config.php
注册了它,但它不起作用,我该如何解决?
'providers' => [
....
Softon\Indipay\IndipayServiceProvider::class,
....
];
谢谢。
答案 0 :(得分:0)
在你的Laravel中vendor\softon\indipay\src\IndipayServiceProvider.php
修改register
函数,以便绑定中没有前导斜杠。
$this->app->bind('indipay', '\Softon\Indipay\Indipay');
$this->app->bind('\Softon\Indipay\Gateways\PaymentGatewayInterface','\Softon\Indipay\Gateways\\'.$gateway.'Gateway');
现在应该看起来像
$this->app->bind('indipay', 'Softon\Indipay\Indipay');
$this->app->bind('Softon\Indipay\Gateways\PaymentGatewayInterface','Softon\Indipay\Gateways\\'.$gateway.'Gateway');
另外,不要忘记将Indipay别名添加为
'Indipay' => 'Softon\Indipay\Facades\Indipay',
在config/app.php