I had created a class Payment.php in the app directory of my laravel project, and I'm trying to use it in my HomeController.php controller . I had imported my payment class by using use App\Payment;statement, but it shows the following error
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Class 'App\Payment' not found
app\http\controllers\ HomeController.php
<?php
namespace App\Http\Controllers;
use App\Payment;
use Illuminate\Http\Request;
class HomeController extends Controller
{
public function index(){
$payment = new Payment();
}
}
app\ Payment.php
<?php
class Payment {
private $url;
private $salt;
private $params = array();
public function __construct ( $salt, $env = 'test' )
{
$this->salt = $salt;
switch ( $env ) {
case 'test' :
$this->url="https://testpay.easebuzz.in/";
break;
case 'prod' :
$this->url = 'https://pay.easebuzz.in/';
break;
default :
$this->url="https://testpay.easebuzz.in/";
}
}
}
namespace App;above your class definition.