Passing custom query results to layout template part
Hi
I'm a bit confused on how to do this. I have a template part (budget.blade.php) that I'm including in my template (@include). I need to get variables from a custom query based on user into this template part . (users company budget, orders total,...). I tried with a Service provider
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\View;
use App\Order;
use App\Product;
use App\Company;
use Auth;
class BudgetServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
view()->composer('layouts.budget', function () {
// Can I perform my queries here and if how do I pass them to layouts/budget.blade.php?
});
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
//
}
}