/home/bdqbpbxa/api-uniferx.goodface.com.ua/app/Http/Resources/Pages/GeneralTranslationResource.php
<?php
namespace App\Http\Resources\Pages;
use App\Helpers\ResourceHelper;
use App\Http\Resources\Pages\Options\OptionCollection;
use App\Http\Resources\Pages\TermsConditions\BlockCollection;
use App\Models\Post;
use App\Models\Product;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
/**
* @OA\Schema(title="GeneralTranslationResource", description="GeneralTranslation resource",
* @OA\Xml(name="GeneralTranslationResource")
* )
*/
class GeneralTranslationResource extends JsonResource
{
/**
* @OA\Property(property="menu_logo", type="string", example=""),
* @OA\Property(property="menu_company_text", type="string", example=""),
* @OA\Property(property="menu_products_text", type="string", example=""),
* @OA\Property(property="menu_resources_text", type="string", example=""),
* @OA\Property(property="menu_contacts_text", type="string", example=""),
* @OA\Property(property="menu_change_country_text", type="string", example=""),
* @OA\Property(property="menu_about_text", type="string", example=""),
* @OA\Property(property="menu_news_text", type="string", example=""),
* @OA\Property(property="menu_career_text", type="string", example=""),
* @OA\Property(property="menu_all_products_btn", type="string", example=""),
* @OA\Property(property="menu_crop_nutrition_text", type="string", example=""),
* @OA\Property(property="menu_trial_results_text", type="string", example=""),
* @OA\Property(property="menu_information_materials_text", type="string", example=""),
* @OA\Property(property="menu_all_resources_btn", type="string", example=""),
* @OA\Property(property="menu_choose_country_text", type="string", example=""),
* @OA\Property(property="menu_available_languages_text", type="string", example=""),
* @OA\Property(property="menu_save_choice_text", type="string", example=""),
* @OA\Property(property="menu_search_placeholder", type="string", example=""),
* @OA\Property(property="menu_clear_button_text", type="string", example=""),
* @OA\Property(property="menu_search_results_text", type="string", example=""),
* @OA\Property(property="menu_search_not_found_text", type="string", example=""),
* @OA\Property(property="footer_logo", type="string", example=""),
* @OA\Property(property="footer_description_text", type="string", example=""),
* @OA\Property(property="footer_company_section_text_text", type="string", example=""),
* @OA\Property(property="footer_about_text", type="string", example=""),
* @OA\Property(property="footer_news_text", type="string", example=""),
* @OA\Property(property="footer_career_text", type="string", example=""),
* @OA\Property(property="footer_contacts_text", type="string", example=""),
* @OA\Property(property="footer_products_section_text_text", type="string", example=""),
* @OA\Property(property="footer_organic_line_text", type="string", example=""),
* @OA\Property(property="footer_wuxal_text", type="string", example=""),
* @OA\Property(property="footer_fertiplant_text", type="string", example=""),
* @OA\Property(property="footer_uniferx_text", type="string", example=""),
* @OA\Property(property="footer_resources_section_text_text", type="string", example=""),
* @OA\Property(property="footer_nutrition_programs_text", type="string", example=""),
* @OA\Property(property="footer_trial_results_text", type="string", example=""),
* @OA\Property(property="footer_information_materials_text", type="string", example=""),
* @OA\Property(property="footer_social_media_text", type="string", example=""),
* @OA\Property(property="footer_instagram_link", type="string", example=""),
* @OA\Property(property="footer_facebook_link", type="string", example=""),
* @OA\Property(property="footer_youtube_link", type="string", example=""),
* @OA\Property(property="footer_contacts_section_text", type="string", example=""),
* @OA\Property(property="footer_contacts_email_text", type="string", example=""),
* @OA\Property(property="footer_contacts_phone_text", type="string", example=""),
* @OA\Property(property="footer_contacts_address_text", type="string", example=""),
* @OA\Property(property="cookie_icon", type="string", example=""),
* @OA\Property(property="cookie_title", type="string", example=""),
* @OA\Property(property="cookie_description", type="string", example=""),
* @OA\Property(property="cookie_btn", type="string", example=""),
* @OA\Property(property="404_title", type="string", example=""),
* @OA\Property(property="404_description", type="string", example=""),
* @OA\Property(property="404_btn", type="string", example=""),
*/
public string|null $name;
public string|null $language;
public string|null $country;
public array|null $data;
public function __construct($resource, $language, $country)
{
parent::__construct($resource);
$this->name = $resource->name;
$this->language = $language;
$this->country = $country;
$this->data = $resource->data;
}
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
// dd($this->data);
return [
'menu_logo' => ResourceHelper::getImage($this->data['menu_logo'] ?? null),
'menu_company_text' => ResourceHelper::getValue($this->data['menu_company_text'] ?? null, $this->country, $this->language),
'menu_products_text' => ResourceHelper::getValue($this->data['menu_products_text'] ?? null, $this->country, $this->language),
'menu_resources_text' => ResourceHelper::getValue($this->data['menu_resources_text'] ?? null, $this->country, $this->language),
'menu_contacts_text' => ResourceHelper::getValue($this->data['menu_contacts_text'] ?? null, $this->country, $this->language),
'menu_change_country_text' => ResourceHelper::getValue($this->data['menu_change_country_text'] ?? null, $this->country, $this->language),
'menu_about_text' => ResourceHelper::getValue($this->data['menu_about_text'] ?? null, $this->country, $this->language),
'menu_news_text' => ResourceHelper::getValue($this->data['menu_news_text'] ?? null, $this->country, $this->language),
'menu_career_text' => ResourceHelper::getValue($this->data['menu_career_text'] ?? null, $this->country, $this->language),
'menu_all_products_btn' => ResourceHelper::getValue($this->data['menu_all_products_btn'] ?? null, $this->country, $this->language),
'menu_crop_nutrition_text' => ResourceHelper::getValue($this->data['menu_crop_nutrition_text'] ?? null, $this->country, $this->language),
'menu_trial_results_text' => ResourceHelper::getValue($this->data['menu_trial_results_text'] ?? null, $this->country, $this->language),
'menu_information_materials_text' => ResourceHelper::getValue($this->data['menu_information_materials_text'] ?? null, $this->country, $this->language),
'menu_all_resources_btn' => ResourceHelper::getValue($this->data['menu_all_resources_btn'] ?? null, $this->country, $this->language),
'menu_choose_country_text' => ResourceHelper::getValue($this->data['menu_choose_country_text'] ?? null, $this->country, $this->language),
'menu_available_languages_text' => ResourceHelper::getValue($this->data['menu_available_languages_text'] ?? null, $this->country, $this->language),
'menu_save_choice_text' => ResourceHelper::getValue($this->data['menu_save_choice_text'] ?? null, $this->country, $this->language),
'menu_search_placeholder' => ResourceHelper::getValue($this->data['menu_search_placeholder'] ?? null, $this->country, $this->language),
'menu_clear_button_text' => ResourceHelper::getValue($this->data['menu_clear_button_text'] ?? null, $this->country, $this->language),
'menu_search_results_text' => ResourceHelper::getValue($this->data['menu_search_results_text'] ?? null, $this->country, $this->language),
'menu_search_not_found_text' => ResourceHelper::getValue($this->data['menu_search_not_found_text'] ?? null, $this->country, $this->language),
'menu_search_products_text' => ResourceHelper::getValue($this->data['menu_search_products_text'] ?? null, $this->country, $this->language),
'menu_search_all_products_text' => ResourceHelper::getValue($this->data['menu_search_all_products_text'] ?? null, $this->country, $this->language),
'menu_search_resources_text' => ResourceHelper::getValue($this->data['menu_search_resources_text'] ?? null, $this->country, $this->language),
'menu_search_all_resources_text' => ResourceHelper::getValue($this->data['menu_search_all_resources_text'] ?? null, $this->country, $this->language),
'menu_search_nutrition_programs_text' => ResourceHelper::getValue($this->data['menu_search_nutrition_programs_text'] ?? null, $this->country, $this->language),
'menu_search_all_nutrition_programs_text' => ResourceHelper::getValue($this->data['menu_search_all_nutrition_programs_text'] ?? null, $this->country, $this->language),
'menu_search_trial_results_text' => ResourceHelper::getValue($this->data['menu_search_trial_results_text'] ?? null, $this->country, $this->language),
'menu_search_all_trial_results_text' => ResourceHelper::getValue($this->data['menu_search_all_trial_results_text'] ?? null, $this->country, $this->language),
'menu_search_posts_text' => ResourceHelper::getValue($this->data['menu_search_posts_text'] ?? null, $this->country, $this->language),
'menu_search_all_posts_text' => ResourceHelper::getValue($this->data['menu_search_all_posts_text'] ?? null, $this->country, $this->language),
'menu_search_vacancies_text' => ResourceHelper::getValue($this->data['menu_search_vacancies_text'] ?? null, $this->country, $this->language),
'menu_search_all_vacancies_text' => ResourceHelper::getValue($this->data['menu_search_all_vacancies_text'] ?? null, $this->country, $this->language),
// 'footer_logo' => ResourceHelper::getImage($this->data['footer_logo'] ?? null),
'footer_description_text' => ResourceHelper::getValue($this->data['footer_description_text'] ?? null, $this->country, $this->language),
// 'footer_company_section_text_text' => ResourceHelper::getValue($this->data['footer_company_section_text_text'] ?? null, $this->country, $this->language),
// 'footer_about_text' => ResourceHelper::getValue($this->data['footer_about_text'] ?? null, $this->country, $this->language),
// 'footer_news_text' => ResourceHelper::getValue($this->data['footer_news_text'] ?? null, $this->country, $this->language),
// 'footer_career_text' => ResourceHelper::getValue($this->data['footer_career_text'] ?? null, $this->country, $this->language),
// 'footer_contacts_text' => ResourceHelper::getValue($this->data['footer_contacts_text'] ?? null, $this->country, $this->language),
// 'footer_products_section_text_text' => ResourceHelper::getValue($this->data['footer_products_section_text_text'] ?? null, $this->country, $this->language),
// 'footer_organic_line_text' => ResourceHelper::getValue($this->data['footer_organic_line_text'] ?? null, $this->country, $this->language),
// 'footer_wuxal_text' => ResourceHelper::getValue($this->data['footer_wuxal_text'] ?? null, $this->country, $this->language),
// 'footer_fertiplant_text' => ResourceHelper::getValue($this->data['footer_fertiplant_text'] ?? null, $this->country, $this->language),
// 'footer_uniferx_text' => ResourceHelper::getValue($this->data['footer_uniferx_text'] ?? null, $this->country, $this->language),
// 'footer_resources_section_text_text' => ResourceHelper::getValue($this->data['footer_resources_section_text_text'] ?? null, $this->country, $this->language),
// 'footer_nutrition_programs_text' => ResourceHelper::getValue($this->data['footer_nutrition_programs_text'] ?? null, $this->country, $this->language),
// 'footer_trial_results_text' => ResourceHelper::getValue($this->data['footer_trial_results_text'] ?? null, $this->country, $this->language),
// 'footer_information_materials_text' => ResourceHelper::getValue($this->data['footer_information_materials_text'] ?? null, $this->country, $this->language),
'footer_social_media_text' => ResourceHelper::getValue($this->data['footer_social_media_text'] ?? null, $this->country, $this->language),
'footer_instagram_link' => ResourceHelper::getValue($this->data['footer_instagram_link'] ?? null, $this->country, $this->language),
'footer_facebook_link' => ResourceHelper::getValue($this->data['footer_facebook_link'] ?? null, $this->country, $this->language),
'footer_youtube_link' => ResourceHelper::getValue($this->data['footer_youtube_link'] ?? null, $this->country, $this->language),
// 'footer_contacts_section_text' => ResourceHelper::getValue($this->data['footer_contacts_section_text'] ?? null, $this->country, $this->language),
'footer_contacts_email_text' => ResourceHelper::getValue($this->data['footer_contacts_email_text'] ?? null, $this->country, $this->language),
'footer_contacts_phone_text' => ResourceHelper::getValue($this->data['footer_contacts_phone_text'] ?? null, $this->country, $this->language),
'footer_contacts_address_text' => ResourceHelper::getValue($this->data['footer_contacts_address_text'] ?? null, $this->country, $this->language),
'footer_copyright_text' => ResourceHelper::getValue($this->data['footer_copyright_text'] ?? null, $this->country, $this->language),
'footer_terms_conditions_text' => ResourceHelper::getValue($this->data['footer_terms_conditions_text'] ?? null, $this->country, $this->language),
'footer_legal_info_text' => ResourceHelper::getValue($this->data['footer_legal_info_text'] ?? null, $this->country, $this->language),
'footer_cookie_policy_text' => ResourceHelper::getValue($this->data['footer_cookie_policy_text'] ?? null, $this->country, $this->language),
// 'footer_anonymous_feedback_text' => ResourceHelper::getValue($this->data['footer_anonymous_feedback_text'] ?? null, $this->country, $this->language),
'cookie_icon' => ResourceHelper::getImage($this->data['cookie_icon'] ?? null),
'cookie_title' => ResourceHelper::getValue($this->data['cookie_title'] ?? null, $this->country, $this->language),
'cookie_description' => ResourceHelper::getValue($this->data['cookie_description'] ?? null, $this->country, $this->language),
'cookie_btn' => ResourceHelper::getValue($this->data['cookie_btn'] ?? null, $this->country, $this->language),
'404_title' => ResourceHelper::getValue($this->data['404_title'] ?? null, $this->country, $this->language),
'404_description' => ResourceHelper::getValue($this->data['404_description'] ?? null, $this->country, $this->language),
'404_btn' => ResourceHelper::getValue($this->data['404_btn'] ?? null, $this->country, $this->language),
'other_show_more_button' => ResourceHelper::getValue($this->data['other_show_more_button'] ?? null, $this->country, $this->language),
'sidebar_text_crop_nutrition' => ResourceHelper::getValue($this->data['sidebar_text_crop_nutrition'] ?? null, $this->country, $this->language),
'sidebar_text_trials_result' => ResourceHelper::getValue($this->data['sidebar_text_trials_result'] ?? null, $this->country, $this->language),
'dropdown_not_selected_text' => ResourceHelper::getValue($this->data['dropdown_not_selected_text'] ?? null, $this->country, $this->language),
'reset_filter' => ResourceHelper::getValue($this->data['reset_filter'] ?? null, $this->country, $this->language),
'cta_tag' => ResourceHelper::getValue($this->data['cta_tag'] ?? null, $this->country, $this->language),
'cta_feedback_title' => ResourceHelper::getValue($this->data['cta_feedback_title'] ?? null, $this->country, $this->language),
'cta_anonymous_feedback_title' => ResourceHelper::getValue($this->data['cta_anonymous_feedback_title'] ?? null, $this->country, $this->language),
'cta_title' => ResourceHelper::getValue($this->data['cta_title'] ?? null, $this->country, $this->language),
'cta_description' => ResourceHelper::getValue($this->data['cta_description'] ?? null, $this->country, $this->language),
'cta_image' => ResourceHelper::getImage($this->data['cta_image'] ?? null),
'cta_field_name_title' => ResourceHelper::getValue($this->data['cta_field_name_title'] ?? null, $this->country, $this->language),
'cta_field_name_placeholder' => ResourceHelper::getValue($this->data['cta_field_name_placeholder'] ?? null, $this->country, $this->language),
'cta_field_last_name_title' => ResourceHelper::getValue($this->data['cta_field_last_name_title'] ?? null, $this->country, $this->language),
'cta_field_last_name_placeholder' => ResourceHelper::getValue($this->data['cta_field_last_name_placeholder'] ?? null, $this->country, $this->language),
'cta_field_email_title' => ResourceHelper::getValue($this->data['cta_field_email_title'] ?? null, $this->country, $this->language),
'cta_field_email_placeholder' => ResourceHelper::getValue($this->data['cta_field_email_placeholder'] ?? null, $this->country, $this->language),
'cta_field_phone_title' => ResourceHelper::getValue($this->data['cta_field_phone_title'] ?? null, $this->country, $this->language),
'cta_field_phone_placeholder' => ResourceHelper::getValue($this->data['cta_field_phone_placeholder'] ?? null, $this->country, $this->language),
'cta_field_organization_title' => ResourceHelper::getValue($this->data['cta_field_organization_title'] ?? null, $this->country, $this->language),
'cta_field_organization_placeholder' => ResourceHelper::getValue($this->data['cta_field_organization_placeholder'] ?? null, $this->country, $this->language),
'cta_field_sender_title' => ResourceHelper::getValue($this->data['cta_field_sender_title'] ?? null, $this->country, $this->language),
'cta_field_sender_options' => isset($this->data['cta_field_sender_options']) ? OptionCollection::make( is_array($this->data['cta_field_sender_options']) ? $this->data['cta_field_sender_options'] : json_decode($this->data['cta_field_sender_options']))->country($this->country)->language($this->language) : null,
'cta_field_subject_message_title' => ResourceHelper::getValue($this->data['cta_field_subject_message_title'] ?? null, $this->country, $this->language),
'cta_field_subject_message_placeholder' => ResourceHelper::getValue($this->data['cta_field_subject_message_placeholder'] ?? null, $this->country, $this->language),
'cta_field_message_title' => ResourceHelper::getValue($this->data['cta_field_message_title'] ?? null, $this->country, $this->language),
'cta_field_message_placeholder' => ResourceHelper::getValue($this->data['cta_field_message_placeholder'] ?? null, $this->country, $this->language),
'cta_field_file_title' => ResourceHelper::getValue($this->data['cta_field_file_title'] ?? null, $this->country, $this->language),
'cta_field_file_placeholder' => ResourceHelper::getValue($this->data['cta_field_file_placeholder'] ?? null, $this->country, $this->language),
'cta_policy_text' => ResourceHelper::getValue($this->data['cta_policy_text'] ?? null, $this->country, $this->language),
'cta_policy_careers_text' => ResourceHelper::getValue($this->data['cta_policy_careers_text'] ?? null, $this->country, $this->language),
'cta_submit_button' => ResourceHelper::getValue($this->data['cta_submit_button'] ?? null, $this->country, $this->language),
'cta_thanks_title' => ResourceHelper::getValue($this->data['cta_thanks_title'] ?? null, $this->country, $this->language),
'cta_thanks_image' => ResourceHelper::getImage($this->data['cta_thanks_image'] ?? null),
'cta_thanks_description' => ResourceHelper::getValue($this->data['cta_thanks_description'] ?? null, $this->country, $this->language),
'cta_thanks_social_text' => ResourceHelper::getValue($this->data['cta_thanks_social_text'] ?? null, $this->country, $this->language),
'cta_required_error' => ResourceHelper::getValue($this->data['cta_required_error'] ?? null, $this->country, $this->language),
'cta_invalid_error' => ResourceHelper::getValue($this->data['cta_invalid_error'] ?? null, $this->country, $this->language),
'blog_type_Research' => ResourceHelper::getValue($this->data['blog_type_Research'] ?? null, $this->country, $this->language),
'blog_type_News' => ResourceHelper::getValue($this->data['blog_type_News'] ?? null, $this->country, $this->language),
'blog_type_Article' => ResourceHelper::getValue($this->data['blog_type_Article'] ?? null, $this->country, $this->language),
'blog_type_Event' => ResourceHelper::getValue($this->data['blog_type_Event'] ?? null, $this->country, $this->language),
'blog_type_Promo' => ResourceHelper::getValue($this->data['blog_type_Promo'] ?? null, $this->country, $this->language),
'product_about_tag' => ResourceHelper::getValue($this->data['product_about_tag'] ?? null, $this->country, $this->language),
'benefits_title' => ResourceHelper::getValue($this->data['benefits_title'] ?? null, $this->country, $this->language),
];
}
}