Composers/FrontendViewComposer.php
private function assignDynamicFieldsToPageObject($view)
    {
        $arrAllow = ['page', 'homepage',"en.blog.slug"];
        $data = $view->getData();
        $routName = Route::currentRouteName();

        if (in_array($routName, $arrAllow)) {
            $arrType = config('asgard.dynamicfield.config.entity-type');
            $arrType =  array_keys($arrType);
            if (count($data)) {
                foreach ($data as $item) {
                    if (is_object($item)) {
                        $className = get_class($item);
                        if (in_array($className, $arrType)) {
                            $locale = LaravelLocalization::getCurrentLocale();
                            $request = Request::all();
                            $dynamicFields = new DynamicFields($item, $locale);
                            $dynamicFields->init($request);
                            $fieldValues = $dynamicFields->getFieldValues($locale);
                            $view->with('dynamicfields', $fieldValues);
                        }
                    }
                }
            }
        }

        return $view;
    }
private function assignDynamicFieldsToPageObject($view)
    {
        $arrAllow = ['page', 'homepage',"en.blog.slug"];
        $data = $view->getData();
        $routName = Route::currentRouteName();

        if (in_array($routName, $arrAllow)) {
            $arrType = config('asgard.dynamicfield.config.entity-type');
            $arrType =  array_keys($arrType);
            if (count($data)) {
                foreach ($data as $item) {
                    if (is_object($item)) {
                        $className = get_class($item);
                        if (in_array($className, $arrType)) {
                            $locale = LaravelLocalization::getCurrentLocale();
                            $request = Request::all();
                            $dynamicFields = new DynamicFields($item, $locale);
                            $dynamicFields->init($request);
                            $fieldValues = $dynamicFields->getFieldValues($locale);
                            $view->with('dynamicfields', $fieldValues);
                        }
                    }
                }
            }
        }

        return $view;
    }
@param $view

@return mixed