Here is my application structure,
my-first-app
|
|-app
|
| -Commands
| -Console
| -Events
| -Http
| -models(custom define folder)
|
|-Base(folder)
| |
| | -StuDetails.php
| | -StuDetailsQuery.php
|
|-Map(foder)
|-StuDetails.php
|-StuDetailsQuery.php
Actually I'm using propel ORM to retrieve data from the database. I created my model classes inside the folder models. Then I tried to access StudetailsQuery class inside my pageController class which is inside http folder extended as Controller.
Here it is :
<?php
namespace App\models\propel;
namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Base\StuDetailsQuery;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\View;
class pagesController extends Controller
{
public function index()
{
$stu= StuDetailsQuery::create()->find();
return view('pages.index', compact('stu'));
}
But I get error :
PHP Fatal error: Class 'Base\StuDetailsQuery' not found in /var/www/my-first-app/app/Http/Controllers/pagesController.php
I tried;
- composer dump-autoload
adding following lines to composer.json file
"autoload": { "psr-4":{ "propel\": "app/models/propel/" }}
but nothing goes fine for me.. Any suggestions please ??