Created
July 13, 2015 22:00
-
-
Save sunnysingh/bb442b2b16a34ac2888c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php namespace App\Http\ViewComposers; | |
| use Illuminate\Contracts\View\View; | |
| use Auth; | |
| class AppComposer { | |
| /** | |
| * Create a new app composer. | |
| */ | |
| public function __construct() | |
| { | |
| // | |
| } | |
| /** | |
| * Bind data to the view. | |
| * | |
| * @param View $view | |
| * @return void | |
| */ | |
| public function compose(View $view) | |
| { | |
| $view->with([ | |
| 'user' => Auth::user(), | |
| ]); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php namespace App\Providers; | |
| use View; | |
| use Illuminate\Support\ServiceProvider; | |
| class ComposerServiceProvider extends ServiceProvider { | |
| /** | |
| * Register bindings in the container. | |
| * | |
| * @return void | |
| */ | |
| public function boot() | |
| { | |
| // App composer | |
| View::composer([ | |
| 'settings.*', | |
| // add your templates here that extend app | |
| ], 'App\Http\ViewComposers\AppComposer'); | |
| } | |
| /** | |
| * Register | |
| * | |
| * @return void | |
| */ | |
| public function register() | |
| { | |
| // | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment