Support the ongoing development of Laravel.io →
Views Blade Architecture
Last updated 2 years ago.
0

You may create controllers for both, users with js and without. Before routing you would create a Middleware to check if user has js. This is the easiest way in my opinion.

Depending on your controllers and what they return you could create a master Middleware controller. You create a controller as usual for all your modules. The controllers than only return the json data. Your master controller or a Middleware could hook the process between controller - frontend and decide either it's js or not. If I am not wrong Laravel fires events before rendering a view. So you could start there.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

johannesz johannesz Joined 24 Feb 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.