namespace App\Http\Controllers;
class HomeController extends Controller
{
protected $sharedData;
public function __construct()
{
$this->sharedData = app('sharedData');
}
public function index()
{
return view('home', [
'maxUploads' => $this->sharedData->maxUploads,
'apiRateLimit' => $this->sharedData->apiRateLimit,
'theme' => $this->sharedData->theme,
]);
}
}
You can also share the singleton data globally in views using the View::share
method.