Global data from eloquent in Laravel to be used for layout <p>I am using some variables in the layout which will load data from the eloquent. For this purpose I am using repository pattern which are injected into the controller through constructor. But obviously, I don't want to repeat this logic in every controller I make.</p> <p>What is the best approach to solve this? </p> <p>I have tried injecting the repositories into the BaseController constructor, but the baseController constructor is not getting called automatically. I need to call for parent::__construct() first which requires repositories parameters to be passed. Which I believe is not the correct way to do this.</p> <p>This is my BaseController. </p> <pre><code> class BaseController extends Controller { /** * Setup the layout used by the controller. * * @return void */ protected $repo; public function __construct(Repository $repo) { $this-&gt;repo = $repo; } protected function setupLayout() { if ( ! is_null($this-&gt;layout)) { $this-&gt;layout = View::make($this-&gt;layout); } $data = $this-&gt;repo-&gt;someMethod(); View::share('global_data',$data); } } </code></pre> <p>BaseController constructor is not called automatically to resolve the dependencies.</p> <p>What is the best approach to have global data from repositories to be used in the layout?</p>