samedi 30 septembre 2017

Laravel - Call other package in my package

i'm creating my package for my develop. I create package name "News" and i want use multiple language so i use package "mcamara/laravel-localization". In main app, i had configed and website had worked. In my package, when i create route with same main App, it's reported "Class translator does not exist".

Please help me My route

Route::group(
[
    'prefix' => LaravelLocalization::setLocale(),
    'middleware' => [ 'localeSessionRedirect', 'localizationRedirect', 'localeViewPath' ]
],
function()
{
    /** ADD ALL LOCALIZED ROUTES INSIDE THIS GROUP **/
    Route::get('/', function()
    {
        return View::make('home');
    });

});

And my packageProvider

class NewsServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        //
        $this->loadMigrationsFrom(__DIR__.'/migrations');
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        include __DIR__.'/routes.php';
        $this->app->make('Test\News\Controllers\NewsController');
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire