3
네임 스페이스에 문제가있어 사용하고 있습니다.PHP Laravel : 특성을 찾을 수 없습니다.
namespace Billing\BillingInterface;
interface BillingInterface
{
public function charge($data);
public function subscribe($data);
public function cancel($data);
public function resume($data);
}
PaymentController.php
Billing.php :
다음은 내 Laravel 응용 프로그램에서 파일을 수 있습니다 "을 (를) 찾을 수 없습니다 형질 '결제 \의 BillingInterface'"
나는이 오류
use Billing\BillingInterface;
class PaymentsController extends BaseController
{
use BillingInterface;
public function __construct(BillingPlatform $BillingProvider)
{
$this->BillingProvider = $BillingProvider;
}
}
사용 및 네임 스페이스를 올바르게 사용하는 방법은 무엇입니까?
컨트롤러에 구현하고 싶지 않습니다. – andershagbard
@andershagbard 그러면 BillingInterface의 메소드를 구현하는 특성을 만들어야합니다. 그러나 특성은 PHP에서 타입이 아니며 iterface를 구현할 수 없기 때문에'PaymentsController'에서 타입 계층을 잃을 것이므로'BillingInterface'가 아닙니다. 대신 가장 좋은 방법은 과금을 처리 할 수있는 객체를 컨트롤러에 주입하는 것입니다. 아마 그것이 'BillingPlatform'의 핵심이지만 확실하지 않습니다. – robbmj
내 구성 기능에서 내가하는 일이 아닌가요? – andershagbard