Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Undefined index: en" when updating a Post, Multi language, Translatable, Translations #3181

Closed
nonmasterpro opened this issue May 15, 2018 · 4 comments

Comments

@nonmasterpro
Copy link

nonmasterpro commented May 15, 2018

  • Laravel Version: 5.6
  • Voyager Version: 1.1
  • PHP Version: 7.2.5
  • Database Driver & Version: MariaDB 10.1.26

Description:

Error occurs when I create and update a post.

Steps To Reproduce:

'multilingual' => [
        /*
         * Set whether or not the multilingual is supported by the BREAD input.
         */
        'enabled' => true,

        /*
         * Select default language
         */
        'default' => 'en',

        /*
         * Select languages that are supported.
         */
        'locales' => [
            'en',
            'th'
        ],
    ],

ErrorException thrown with message "Undefined index: en"

[stacktrace]

#0 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/tcg/voyager/src/Traits/Translatable.php(307): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8, 'Undefined index...', '/var/www/vhosts...', 307, Array)
#1 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/tcg/voyager/src/Http/Controllers/Controller.php(51): TCG\\Voyager\\Models\\Post->prepareTranslations(Object(Illuminate\\Http\\Request))
#2 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/tcg/voyager/src/Http/Controllers/VoyagerBaseController.php(228): TCG\\Voyager\\Http\\Controllers\\Controller->insertUpdateData(Object(Illuminate\\Http\\Request), 'posts', Object(Illuminate\\Database\\Eloquent\\Collection), Object(App\\Post))
#3 [internal function]: TCG\\Voyager\\Http\\Controllers\\VoyagerBaseController->update(Object(Illuminate\\Http\\Request), '6')
#4 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#5 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction('update', Array)
#6 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Route.php(212): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\Voyager\\VoyagerBaseController), 'update')
#7 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Route.php(169): Illuminate\\Routing\\Route->runController()
#8 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Router.php(659): Illuminate\\Routing\\Route->run()
#9 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#10 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/tcg/voyager/src/Http/Middleware/VoyagerAdminMiddleware.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#11 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): TCG\\Voyager\\Http\\Middleware\\VoyagerAdminMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#12 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#13 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/app/Http/Middleware/WebLocalization.php(22): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#14 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): App\\Http\\Middleware\\WebLocalization->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#15 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#16 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#17 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#18 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#19 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(67): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#20 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#21 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#22 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#23 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#24 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#25 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(63): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#26 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#27 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#29 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#30 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#31 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#32 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#33 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#34 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#35 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Router.php(661): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#36 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Router.php(636): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#37 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Router.php(602): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#38 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Router.php(591): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#39 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#40 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#41 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#42 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#43 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#44 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#45 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#46 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#47 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#48 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#49 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#50 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#51 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#53 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#54 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#55 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#56 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#57 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#58 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#59 /var/www/vhosts/datahorizon.asia/test.flower-delivery-compare.asia/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#60 {main}
"} 

Error occurs

// Set the default local value
$request->merge([$field => $trans[config('voyager.multilingual.default', 'en')]]);
@nonmasterpro nonmasterpro changed the title Undefined index: en, Multi language, Translatable, Translations "Undefined index: en" when updating a Post, Multi language, Translatable, Translations May 15, 2018
@emptynick
Copy link
Collaborator

Please search before opening a new issue.
Duplicate of #3089
Possible fix in #3115

@nonmasterpro
Copy link
Author

@emptynick it not helps, i try it already.

@emptynick
Copy link
Collaborator

Doesn't change that fact that its an exact duplicate of #3089.
Look at the stacktrace.
If the PR does not work for you, please comment there that it doesn't work instead of opening yet another issue.
By the way, I did see your original comment here. Not so nice!

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants