L
L
lynnikvadim2016-04-19 15:18:50
Laravel
lynnikvadim, 2016-04-19 15:18:50

How to pass data using a service provider to all templates?

How to pass data using a service provider to all templates?
For example, get all fields from the set table and transfer them to view.
Is this possible to implement?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rikcon, 2016-04-19
@Rikcon

app/providers/appserviceprovider.php
boot method

public function boot()
    {
        view()->composer('*', function($view){
            $view->with('user', \Sentinel::getUser());
        });
    }

I did it like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question