Alternatively, inject the shared data into the constructor:
namespace App\Http\Controllers;
class ExampleController extends Controller
{
protected $sharedData;
public function __construct()
{
$this->sharedData = app('sharedData');
}
public function index()
{
return view('example', [
'maxUploads' => $this->sharedData['max_uploads'],
'apiRateLimit' => $this->sharedData['api_rate_limit'],
]);
}
}