Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace AppProviders;
- use IlluminateSupportServiceProvider;
- use View;
- class ComposerServiceProvider extends ServiceProvider
- {
- /**
- * Bootstrap services.
- *
- * @return void
- */
- public function boot()
- {
- View::composer('plain','AppHttpViewComposersPostComposer');
- }
- /**
- * Register services.
- *
- * @return void
- */
- public function register()
- {
- //
- }
- }
- <?php
- namespace AppHttpViewComposer;
- use IlluminateViewView;
- use AppPost;
- class PostComposer
- {
- public function comspose(View $view)
- {
- $posts = Post::all();
- $view->with('postha', $posts );
- }
- }
Add Comment
Please, Sign In to add comment