Support the ongoing development of Laravel.io →
posted 10 years ago
Views
Last updated 1 year ago.
0

You have various options. This could be a good way:

<?php namespace Acme\Composers;

class UserComposer
{
    public function compose($view)
    {
        $view->with('user', 'ipalaus');
    }
}

Then, you should register your composers:

<?php namespace Acme\Composers;

class ComposersServiceProvider extends \Illuminate\Support\ServiceProvider {

	public function register()
	{
		$view = $this->app['view'];

		$view->composer('users', 'Acme\Composers\UserComposer');
	}

}
Last updated 1 year ago.
0
$this->app->view->composer('users', 'Acme\Support\Composers\UserComposer');
Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.