I have a Laravel 5.5 project where I would need to share some variables throughout all controllers and all views with the option to have some global defaults and then those defaults could be edited within the various controller methods, and in the end the views would show those updated variables.
For example:
$test = [1, 2, 3];
in FooController.php BarMethod I would say:
$test[] = 4;
Then the view file that is accompanied with that BarMethod would see [1, 2, 3, 4].
But if I said something else in TestController.php BazMethod:
$test = array_merge($test, [100, 1000, 10000]);
Then my other view that belongs to this method would see [1, 2, 3, 100, 1000, 10000].
Any ideas are welcome.
Thanks.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire