This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

kukrik
kukrik

I'm sorry to hear my English is not good. I'm also a young boy here. I do a small plugin and I want to get backend_user_preferences-> timezone from the database. I have been looking for a long time and not finding the right solution. There is a value in the database: {"locale": "et", "fallback_locale": "en", "timezone": "Europe \ / Tallinn", "editor_font_size": "12", "editor_word_wrap": fluid, editor_code_folding: manual, editor_tab_size: 4, editor_theme: twilight, editor_show_invisibles: 0, editor_highlight_active_line: 1, editor_use_hard_tabs: 0, editor_show_gutter, : "1", "editor_auto_closing": "0", "editor_autocompletion": "manual", "editor_enable_snippets": "0", "editor_display_indent_guides": "0", "editor_show_print_margin": "0", "user_id": " 1 "}

I have done and this code works correctly, then I want to replace $backend_user_selected_timezone, but how to get it ("timezone": "Europe \ / Tallinn")...

protected function prepareVars() { $uri = explode('/', Request::path()); $about = About::whereId(end($uri))->first();

    // $backend_user_selected_timezone = ??????

   //Here i want to change 2 lines like this...

   // $this->vars['created_at'] = Carbon::parse($about->created_at)->timezone($backend_user_selected_timezone)->format('d.m.Y H:i');
   // $this->vars['updated_at'] = Carbon::parse($about->updated_at)->timezone($backend_user_selected_timezone)->format('d.m.Y H:i');

    // These lines work correctly...
    $this->vars['created_at'] = Carbon::parse($about->created_at)->timezone('Europe/Tallinn')->format('d.m.Y H:i');
    $this->vars['updated_at'] = Carbon::parse($about->updated_at)->timezone('Europe/Tallinn')->format('d.m.Y H:i');

    var_dump($backend_user_selected_timezone);
}

I apologize in advance if I ask a simple question. Thank you in advance!

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.