I build a small app using laravel 5.2. I put all of my files into a folder called Surveys located at App/Modules/Surveys
. "No worries, I am planning to move the Modules out of the App folder, I just need to get the controller to work"
Currently my controller is located on App/Http/Controllers/SurveysController
I want to move my controller folder so it is located on App/Modules/Surveys/Controllers/Frontend/SurveysController
How would I tell laravel to resolve the controller out of this path App/Modules/Surveys/Controllers/Frontend/
instead of App/Http/Controllers
?
I tried to do this into a service provider but it is still not working
<?php
namespace App\Modules\Surveys\Providers;
use Illuminate\Support\ServiceProvider;
class PackageServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
if (! $this->app->routesAreCached()) {
require __DIR__.'/../routes.php';
}
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$this->app->make('Modules\Surveys\Controllers\Frontend\SurveyController');
}
}
What should I do to make the routes point to the correct controller?
Just for clarity my Application instructor starts at the App
App/Https/Controllers App/Modules/Surveys
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire