I am using Laravel 5. To pass the users his favorites and permalink, I edited the AppServiceProvider. I was wondering if my solution is the most reasonable solution.Of particular concern is future extensibility in terms of adding additional views.  I only have the two now but I think it's quite possible that I'll add more in the future.  <?php namespace App\Providers;use Illuminate\Support\ServiceProvider;use App\Models\Favorites;use Auth;class AppServiceProvider extends ServiceProvider {    /**     * Bootstrap any application services.     *     * @return void     */    public function boot()    {        view()->composer('navigation.top-menu-only', function($view) {            $this->getData($view);        });        view()->composer('navigation.menu', function($view) {            $this->getData($view);        });    }    /**     * Register any application services.     *     * This service provider is a great spot to register your various container     * bindings with the application. As you can see, we are registering our     * Registrar implementation here. You can add your own bindings too!     *     * @return void     */    public function register()    {        $this->app->bind(            'Illuminate\Contracts\Auth\Registrar',            'App\Services\Registrar'        );    }    /**     * Get data for menu     *      * @param  object $view     *      * @return view     */    private function getData($view)    {        if (Auth::Check()) {            $favoritesModel = new Favorites();            $companiesModel = new Companies();            $messagesModel = new MessagesSend();            $favorites = $favoritesModel->getFavorites();            $company = $companiesModel->findByUserId(Auth::User()->id);            $unreadMessages = $messagesModel->countRecivedUnreadedMessages();            $lastMessages = $messagesModel->getRecivedMessages(Auth::User()->id, 5);            $view->with('permalink', Auth::User()->permalink)                 ->with('favorites', $favorites)                 ->with('company', $company)                 ->with('unreadMessages', $unreadMessages)                 ->with('lastMessages', $lastMessages);        }    }}
Passing standard data through serviceprovider
php;laravel