PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By
Solved

Save time and only admin can see

Solved
cassiolacerda

Jul 18th, 2022 05:44 AM

Hello, I have some questions!

  1. In my app the user can create posts. When we make a new post, we can select the post date, but it doesn't save the time, just the date. I can't save the correct time, it shows as "00:00:00". The input field is a date field. How can I fix it? Don't salving the time.png

  1. I want to format the post creation date and time. I can do this with the date but not the time. Now I'm using the "%d-%m-%Y" format, but when I use that format, the time doesn't show on the screen, only the date. What format do I use to show date and time formatted like this -> day/month/year hours:minutes. Format date.png

  1. In the post there is the "Owner" field, it shows who created the post, but when regular users see your posts, they can see their own name on the posts. I want to show this information only to the admin user. How can I do this? Field only Admin.png

Thanks for all the help you've given me!

bobbyiliev

Jul 19th, 2022 01:44 AM

Hi there Cassio,

What is the type of the Date of Post column? I believe that if it is set to timestamp it should work out of the box.

This is similar to how the created_at and updated_at columns work in Laravel, those should be crated/updated automatically when a post is created/updated:

laravel voyager created at date

Best,

Bobby

cassiolacerda

Jul 19th, 2022 07:43 AM

Hi Bobby, thanks for the answer, but what about the third question? The third is the most important for me and my project.

bobbyiliev

Jul 22nd, 2022 12:42 AM

Hi there,

Ah yes, sorry for missing that question. I believe that with the current version of Voyager this is not available out of the box, but you ca n do it by adding a check yourself in an overridden views:

Voyager Overriding BREAD Views

As far as I can see in the Voyager GitHub discussions, this feature is actually panned for Voyager V2:

Laravel Voyager: Condition in Browse data

Hope that this helps!

cassiolacerda

Jul 22nd, 2022 10:10 AM

Hi Bobby, I was studying about this last week and I ended up solving it. Thank you so much!

Report
1
bobbyiliev

Jul 23rd, 2022 01:21 AM

Best Answer

No problem at all! Happy to hear that you've already solved this!