Save time and only admin can see
Hello, I have some questions!
- 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?
- 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.
- 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?
Thanks for all the help you've given me!
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:
Best,
Bobby
Hi Bobby, thanks for the answer, but what about the third question? The third is the most important for me and my project.
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!
Hi Bobby, I was studying about this last week and I ended up solving it. Thank you so much!
















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