Reputation: 5367
Is there a way to return the response of a controller method in a view composer function? This is currently returning a string, the namespace.
view()->composer('tasks.partial.tasksummary', function($view)
{
$view->with('taskload', 'App\Http\Controllers\TaskController@taskLoad');
});
or... would it be better to just inject the method in my partial directly (via @inject('..')
)?
Upvotes: 1
Views: 1103
Reputation: 25404
That sounds like something better suited for e.g. a task model. But you could do:
$taskload = (new App\Http\Controllers\Taskcontroller)->taskLoad();
$view->with('taskload', $taskload);
Upvotes: 1