Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jalaf11201's avatar

I'm having problems on deciding an architecture for sub navs, and I'm having trouble on deciding how to manage the page without refresh without messy code.

I'm creating a community based SN, I created manage section for community owners, and there is nav on top like general, privacy, sections (flairs), users (follow, requests), posts (requests, pinned, etc.) inside. I created blade pages for them, but inside them there are sections again. Like Followed, Requests, Pinned, Removed etc. Making separate pages for them would be bad. I don't know if I should just send arguments ?filter=request and display it based on that. What would be professional way for this type of sub sections (navs)?

Also after creating some things I just realized that I have to make sure the page is not getting refresh with the actions like follow, pin, remove, reject, accept etc. There are tons of them, I did follow, delete with the async fetching with js. And also realized I have to fetch posts with it too because of pagination. I don't want it to refresh for next other 20 posts every time. I'm wondering if it would be ok to use tons of async fetch and dom manipulation in the page.

I'm doing this with laravel and without front frameworks. I am having trouble on how to do the architecture so it won't bite me back. I would appreciate your suggestion and examples on these things.

Edit: also, which is the better way, using toggle on action like ban/unban, like/dislike, follow/un, pin/unpin, or creating separate routes and functions for them?

1 like
1 reply
vincent15000's avatar

The only way to update the content of a page without refreshing the page is to use AJAX request, so you have to use JavaScript, send the requests from JS (for example with axios or the native JS function fetch) and update manually the DOM.

You can do this an easier way using either AlpineJS, or HTMX, or Turbo, or simply why not Livewire.

https://alpinejs.dev/

https://laravel.com/docs/13.x/blade#rendering-blade-fragments

https://laracasts.com/series/crafting-web-applications-with-htmx

https://htmx.fr/

https://turbo.hotwired.dev/

https://livewire.laravel.com/

If you want to keep your code light, I suggest you rather AlpineJS or HTMX or Turbo.

Please or to participate in this conversation.