totothegreat
totothegreat

Reputation: 1643

How to make laravel load all classes from a directory?

In my laravel app, i have a controller that does the following before the definition of the controller:

use PayPal\Rest\ApiContext;
use PayPal\Auth\OAuthTokenCredential;
use PayPal\Api\Payer;
use PayPal\Api\Amount;
use PayPal\Api\Transaction;
use PayPal\Api\Payment;
use PayPal\Api\RedirectUrls;
use PayPal\Api\Address;

Simply put, How can i make all the models in the API directory to be used?

Upvotes: 0

Views: 1484

Answers (1)

Jason Lewis
Jason Lewis

Reputation: 18665

Import the PayPal\Api namespace.

use PayPal\Api;

Then you can use the classes via Api\Class.

$payment = new Api\Payment;

Upvotes: 3

Related Questions