Nick Dawes
Nick Dawes

Reputation: 2244

PHP class not found in Laravel controller

I'm having an issue within a Laravel controller, I'm not sure where to begin troubleshooting. Basically 2 separate methods are calling the same external class; the process method works, however when calling process3d I run into the error class 'App\Services\PaymentGateway\Gateway\RequestGatewayEntryPointList' not found.

DebugController.php

namespace App\Http\Controllers;
use App\Services\PaymentGateway\Gateway\RequestGatewayEntryPointList;
...
public function process(Request $request) {
   ...
   $rgeplRequestGatewayEntryPointList = new RequestGatewayEntryPointList;
   ...
}

public function process3d(Request $request) {
   ...
   $rgeplRequestGatewayEntryPointList = new RequestGatewayEntryPointList;
   ...
}

PaymentSystem.php

namespace App\Services\PaymentGateway\Gateway;
...
class RequestGatewayEntryPointList {
   ...
}

I've omitted irrelevant code to keep the question brief, but I'm of course happy to provide more details if it will help.

What's going on?

Upvotes: 0

Views: 364

Answers (1)

Nick Dawes
Nick Dawes

Reputation: 2244

Found it 5 minutes after posting to stackoverflow... oops.

process3d was missing require_once DIR.'/../../Services/PaymentGateway/Gateway/PaymentSystem.php';

Adding this solved the issue.

Upvotes: 1

Related Questions