set global variable in laravel 8 controller code example Example: global variable in laravel controller private $variable;