Conceptual Qs: Part 1: User vs Admin Dashboards, Part 2: Location of 'wave' files, Part 3: Routes
I'm trying to determine if Wave would be suitable for my project. I'd like to better understand how Wave's user vs admin files are structured, Wave vs native Laravel files, and the direction that Wave may take so that I can determine a project structure so that the code and directories be maintainable.
This question is a three part question--I couldn't figure out how to decouple them, since they all seem to be related to how Wave is structured.
For context, I cloned a fresh Wave project from the git repo. The wave
file is at the root of the project structure.
Part 1: User vs Admin Dashboards
I'd like to support User dashboard and Admin dashboards. It seems Wave supports this feature.
I found example Wave files for each, and it looks like they are stored in different places: Admin Dashboard Files: wave/resources/views/widgets/welcome-widget.blade.php User Dashboard Files: resources/themes/anchor/components/app/sidebar.blade.php
I assume I would have to customize these two different directories (one being wave
, one being resources/themes
). If my understanding is correct, I'd like to know to the extent I can customize these directories without breaking future updates. For example, could I move one of these directories so that they are in the same location? (I've seen other projects where admin and auth/user are in the same view directory).
I'm aware there is no single answer. Let me know what is feasible, and any suggested approaches.
Part 2: Location of wave
files
I noticed wave
is at the root of the project folder structure. wave
has a src
file with different Controller files, and yet stores models in Laravel's native app/Model
.
Is wave
a self-contained Composer package? Would it be good practice for wave
to be in vendor
or a package
directory? Could I move wave
into, say vendor
without breaking anything in future updates?
Part 3: Routes
Related to Part 1 and 2's discussion about where wave MVC files are located, I'm trying to understand how routes work in Wave, and Wave's web.php vs Laravel's native web.php.
I'd like to customize routes for the user dashboard and the admin dashboard, if possible. For example, I'd like to append "/accounts" to custom pages that will have a sidebar link (Remember the projects example in the docs?).
I understand user pages use Volt + Folio. I have considered leveraging directories, like: "resources/themes/[themename]/pages/accounts/[custom page here]".
But, is there a way I can do this in just web.php?
Should all Wave user and admin dashboard routes belong in wave/routes/web.php? What is recommended?
Per that logic, should all my other project related (non-Wave dashboard) files belong in native Laravel's routes/web.php?
Let me know what is feasible, and recommended approaches.
Hi there,
Welcome!
Wave is indeed flexible, and you are free to customize it as needed.
Part 1: User vs Admin Dashboards
You're correct that Wave provides separate locations for User and Admin dashboard files.
The Admin dashboard is powered by Filament, so you are free to follow all Filament best practices there.
- The
wave/resources/views/
directory will contain some admin-related views as well as shared components between all Wave themes. - The User Dashboard files in the
resources/themes/[theme]/
directory and are tied to the current theme being used.
For example if you were to move the wave/resources/views/widgets/welcome-widget.blade.php
to resources/themes/anchor/components/app/sidebar.blade.php
other themes would not be able to access the welcome-widget
component.
If you are planning to use 1 specific theme, you can move the files to the theme directory as needed.
Part 2: Location of Wave Files
Answers to Your Questions:
-
Is Wave a self-contained Composer package? No, Wave is not currently a Composer package. It’s directly included in the project structure for easier customization.
-
Can I move Wave to
vendor
or another package directory? Generally speaking, not only for Wave, but for any Laravel app, you can't really move anything manually directly to the vendor directory. Wave is designed to be directly modified in its current location. If you’re looking for a cleaner structure, you could:- Keep Wave files where they are but organize your own custom files in separate folders (e.g.,
app/Custom
). Though for future updates, you might need to merge changes manually and cherry-pick updates. - If you want to treat Wave as a package, you can fork it and include your fork via Composer, but this adds overhead as you’ll need to maintain your fork.
- Keep Wave files where they are but organize your own custom files in separate folders (e.g.,
You could leave the wave
directory in the root. Customize the controllers, models, and views directly in their expected locations while using Laravel's service provider pattern if needed for advanced use cases.
Part 3: Routes
Wave handles routes differently depending on whether they're admin or user-facing:
-
Wave's Routes: Located in
wave/routes/web.php
and used for admin-related or built-in Wave functionality. -
User Theme Routes: Use Folio for dynamic routing based on file structure in
resources/themes/[theme]/pages/
.
Customizing Routes
-
Admin and User Dashboards: You can define custom routes in either Wave's
web.php
or Laravel'sroutes/web.php
. -
Customizing User Dashboard Routes: To add
/accounts
to custom pages:- Place the custom page in
resources/themes/[theme]/pages/accounts/
. - Folio will automatically generate a route for this.
- Alternatively, define explicit routes in
routes/web.php
orwave/routes/web.php
.
Make sure to check out the Wave documentation and the Laravel Folio and Laravel Volt documentations for more details.
- Place the custom page in
-
Admin Routes: Customize admin-specific routes directly in
wave/routes/web.php
and check Filament's documentation for more details.
Hope that this helps! Best thing to do is to experiment and see what works best for your project!
- Bobby