A
A
Alex7792015-06-08 14:39:40
Laravel
Alex779, 2015-06-08 14:39:40

Problem with service providers in Laravel 5?

I started studying Larvel 5. I do everything according to the official documentation. It got to the point where you need to transfer data to all views and nothing happens here. I write in the file app/Providers/AppServiceProvider.php in the boot method the line view()->share('name', 'Name')? gives an error that there is no such variable. What could be the problem? By the way, I tried to delete the app / providers folder, the project seems to work. I would appreciate and appreciate your answers!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alex779, 2015-06-10
@Alex779

Issue closed by installing version 5.1

D
D', 2015-06-08
@Denormalization

I did similar through Middleware.
In Kernel.php in $middleware we prescribe our middleware, which binds the variable.

M
movetz, 2015-06-08
@movetz

public function boot()
{
        \View::share('test', 'Say Hello!');
        //Или
        //view()->share('test', 'Say Hello!');
}

In the warmth:
<p>{{ $test}}></p>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question