I have various components that will go into my Laravel 5.4 app, and each page is built using these components. Each component will have its own logic, making API calls (which will be cached), etc.
Each component controller returns a view after working through its logic.
Here is an example controller:
class ExampleController
{
public function index()
{
$projects = Api::create()->get('project/1234')
return View::make('Pages::components.projectList')
->with('projects', self::$projects);
}
}
What I want to do is create a "master" controller for each page that will bring the various components together.
Something like:
return ExampleController@index . OtherController@index
Later on, I want users to be able to build their own pages using these components, so building static views won't work. The component controllers will always return a view.
How is this done in Laravel? Am I thinking about the problem all wrong?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire