dimsav / laravel-translatable

[Deprecated] A Laravel package for multilingual models
MIT License
1.95k stars 320 forks source link

Data for all localizations without with (['translations']) #542

Closed DmitrySkibitsky closed 5 years ago

DmitrySkibitsky commented 5 years ago
        $query = Category::query();
        $query->with(['children' => function ($query) {
            $query->join('category_item_translations', function ($join) {
                $join->on('category_items.id', '=', 'category_item_translations.category_item_id');
                $join->where('category_item_translations.locale', app()->getLocale());
            });
            $query->select([
                'category_items.id',
                'category_items.category_id',
                'category_items.slug',
                'category_item_translations.name'
            ]);
            $query->orderBy('category_items.sorting_order', 'asc');
        }]);
        if (count($params) > 0) {
            if (in_array('show_on_footer', $params)) {
                $query->where('show_on_footer', true);
            }
        }

        $query->join('category_translations', function ($join) {
            $join->on('categories.id', '=', 'category_translations.category_id');
            $join->where('category_translations.locale', app()->getLocale());
        });

        return $query->select([
            'categories.id',
            'category_translations.name',
        ])->orderBy('sorting_order', 'asc')->get();
@foreach($footer_categories as $category)
            {{dd($category)}}
@endforeach

deepinscreenshot_ - _20190117200541

The $width property is missing from the model.

Q: where does this array with all localization data come from?