inertia-laravel icon indicating copy to clipboard operation
inertia-laravel copied to clipboard

Stack Laravel - InertiaJS - React. How to split the frontend into two applications?

Open Reker7 opened this issue 2 years ago • 1 comments

Greetings, there is a need to split the frontend application into two parts, one part admin and another part user. Stack Laravel - InertiaJS - React. Assets builder - VITE. What methods can be used to solve this problem? And what should my resources directory look like in the end.

Reker7 avatar Sep 27 '22 11:09 Reker7

I'd personally recommend creating a base Layout.js, then creating two layouts that extend this layout:

  • Layout.js
  • UserLayout.js
  • AdminLayout.js
// Layout.js

// Setup your base layout...

return (
    <div>{children}</div>
); 
// UserLayout.js

return (
  <Layout>
    <UserNavbar />

    {children}    
  </Layout>
);
// AdminLayout.js

return (
  <Layout>
    <AdminNavbar />

    {children}    
  </Layout>
);

Then create folders to store unique components/pages:

  • resources/js/Components/Admin/

  • resources/js/Components/User/

  • resources/js/Pages/Admin/

  • resources/js/Pages/User/

stevebauman avatar Sep 29 '22 20:09 stevebauman

Hi there,

Thanks for reporting the problem you are encountering, but it looks like this is a question that may be better suited for a support channel. We only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use the functionality provided by this repository, you can try one of the following channels:

However, this issue will not be locked, and everyone is free to discuss solutions to your problem!

jessarcher avatar Sep 08 '23 01:09 jessarcher