Laravel - How to pass data to include

You don't need to do that, but you can:

All variables that are available to the parent view will be made available to the included view. Even though the included view will inherit all data available in the parent view, you may also pass an array of extra data to the included view:

@include('view.name', ['some' => 'data'])

One option if you're trying to send data only to the included view is to use a view composer. They will fire even in the case of trying to prepare a view for @include

view()->composer('header', function($view) {
    $view->with('data', 'some data');
});

Tags:

Php

Laravel

Blade