I have a standard laravel controller function with over 350 lines of logic for a number of different on-page elements. Some of the logic could be taken out put within it's own function but I would need to pass the variables back to the laravel controller to be used within a view.
Does laravel recommend any standards for this? or can I create a function within a controller and just pass the final variables back as I would in php?
Example of current controller, I would like to split logic from here into its own function and return the values from the new function back to this getIndex() function.
class PubsController extends Controller
{
public function getIndex()
{
//Date Helpers
$dateThisMonth = Carbon::now()->startOfMonth()->toDateString();
$dateLastMonth = Carbon::now()->subMonth()->startOfMonth()->toDateString();
$dateNextMonth = Carbon::now()->addMonth()->startOfMonth()->toDateString();
}
}
return view('greeting', $functionResult)->with('moreFields',...);