I am new in laravel and importing a existing php site. I created a controller named "List" then i need to create a object of a class, coded in a file which is been include by include_once() as shown,
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
$INCLUDE_ROOT = 'path/to/file';
include_once($INCLUDE_ROOT . "ServiceDetails.class.php");
class Lists extends Controller
{
public function show()
{
$objServiceDetails= new ServiceDetails;
.........
........
}
}
But i am getting an error like
Fatal error: Class 'App\Http\Controllers\ServiceDetails' not found
I dont have much idea of namespace "use" and "as". May be that's why i am not able to solve this problem. When creating a new object it is searching class in namespace location only, but it should also look in included files, i think.