A
A
Alexander Kovalchuk2016-05-02 10:52:40
Laravel
Alexander Kovalchuk, 2016-05-02 10:52:40

What is the cause of error in Laravel5.2 Sleeping-owl?

When logging into the admin panel, the following error appeared:

ErrorException in FileLoader.php line 109:
Array to string conversion 
(View: /vendor/sleeping-owl/admin/src/views/default/_partials/user.blade.php)
(View: /vendor/sleeping-owl/admin/src/views/default/_partials/user.blade.php)

Previously, everything worked and I didn’t touch the code that relates to the admin panel, so I wonder what is the reason for this behavior ??
Code inside user.blade.php
<ul class="nav navbar-top-links navbar-right">
  <li class="dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
      <i class="fa fa-user fa-fw"></i> {{ Sentinel::check()->first_name ?: 'admin' }} <i class="fa fa-caret-down"></i>
    </a>
    <ul class="dropdown-menu dropdown-user">
      <li><a href="{{ route('admin.logout') }}"><i class="fa fa-sign-out fa-fw"></i> {{ trans('admin::lang.auth.logout') }}</a></li>
    </ul>
  </li>
</ul>

Code in FileLoader.php
/**
     * Load a locale from a given path.
     *
     * @param  string  $path
     * @param  string  $locale
     * @param  string  $group
     * @return array
     */
    protected function loadPath($path, $locale, $group)
    {
        if ($this->files->exists($full = "{$path}/{$locale}/{$group}.php")) {
            return $this->files->getRequire($full);
        }

        return [];
    }

And this and that in the vendor pack, so you don’t need to change
The problem is in this piece of code, when I take it away everything works
<ul class="dropdown-menu dropdown-user">
      <li><a href="{{ route('admin.logout') }}"><i class="fa fa-sign-out fa-fw"></i> {{ trans('admin::lang.auth.logout') }}</a></li>
    </ul>

And to be precise, the problem is this.
{{ trans('admin::lang.auth.logout') }}
Could there be an error in the result of an array in an array in the translation file?
This problem appeared here and chose a crutch but I want a good solution
The reason is in the config / app.php file
The error pops up when there is more than one language but an array
'locale'=>['uk','en','ru'],

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Kovalchuk, 2016-05-02
@mamut

The reason is in the config / app.php file.
The error pops up when there is not one language but an array . it did not work, now I fixed everything and left it on GitHub so that there were no problems with the project when composer install

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question