Skip to content

Commit d5df74b

Browse files
authored
Laravel Wayfinder (#108)
* Install `laravel/wayfinder` * Configure * Create tsconfig.json * Update Show.vue * Update Show.vue * Update Show.vue * Update Edit.vue * Update Edit.vue * Update Header.vue * Update App.vue * Update Show.vue * Add logout link to email verification page * Update Show.vue * Update Show.vue * Update Show.vue * Remove Ziggy
1 parent fcf24e6 commit d5df74b

File tree

18 files changed

+149
-126
lines changed

18 files changed

+149
-126
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
/public/storage
66
/public/css
77
/public/js
8+
/resources/js/actions
9+
/resources/js/routes
10+
/resources/js/wayfinder
811
/storage/*.key
912
/vendor
1013
.env

bun.lockb

5.33 KB
Binary file not shown.

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
"laravel/pulse": "^1.2",
1313
"laravel/sanctum": "^4.0",
1414
"laravel/tinker": "^2.9",
15+
"laravel/wayfinder": "^0.1.5",
1516
"pxlrbt/filament-environment-indicator": "^2.0",
1617
"sentry/sentry-laravel": "^4.7",
1718
"spatie/laravel-health": "^1.31",
1819
"spatie/laravel-permission": "^6.9",
1920
"spatie/security-advisories-health-check": "^1.2",
2021
"symfony/http-client": "^7.2",
21-
"symfony/postmark-mailer": "^7.2",
22-
"tightenco/ziggy": "^2.3"
22+
"symfony/postmark-mailer": "^7.2"
2323
},
2424
"require-dev": {
2525
"barryvdh/laravel-debugbar": "^3.13",

composer.lock

+63-71
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"laravel-vite-plugin": "^1.2.0",
99
"tailwindcss": "^4.1.6",
1010
"vite": "^6.3.5",
11+
"vite-plugin-run": "^0.6.1",
1112
"vue": "^3.5.13"
1213
},
1314
"private": true,

resources/css/utilities.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
@utility text-link {
2-
@apply underline hover:decoration-transparent transition-colors;
2+
@apply underline cursor-pointer hover:decoration-transparent transition-colors;
33
}

resources/js/Components/Header.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div class="flex items-center">
77
<Link
88
class="shrink-0 text-brand-800"
9-
:href="route('home')"
9+
:href="home()"
1010
>
1111
<SparklesIcon class="size-7" />
1212
</Link>
@@ -85,6 +85,8 @@
8585
import { ref, onMounted } from "vue";
8686
import { router } from '@inertiajs/vue3';
8787
88+
import { index as home } from "@js/actions/App/Http/Controllers/DashboardController";
89+
8890
import {
8991
Sparkles as SparklesIcon,
9092
Menu as MenuIcon,

resources/js/Layouts/App.vue

+17-33
Original file line numberDiff line numberDiff line change
@@ -21,50 +21,34 @@
2121

2222
<script setup>
2323
import { computed, defineAsyncComponent } from "vue";
24-
import { usePage } from '@inertiajs/vue3'
24+
25+
import { index as home } from "@js/actions/App/Http/Controllers/DashboardController";
26+
import { edit as editAccount } from "@js/actions/App/Http/Controllers/AccountController";
27+
import LogoutController from "@js/actions/App/Http/Controllers/LogoutController";
2528
2629
const Header = defineAsyncComponent(() => import("@js/Components/Header.vue"));
2730
const Footer = defineAsyncComponent(() => import("@js/Components/Footer.vue"));
2831
29-
const page = usePage();
30-
3132
const menu = computed(() => {
32-
if (page.props.auth.loggedIn) {
33-
return [
34-
{
35-
label: "Dashboard",
36-
route: route("home"),
37-
condition: true,
38-
components: ['Dashboard/Index'],
39-
},
40-
{
41-
label: "Account",
42-
route: route("account.edit"),
43-
condition: true,
44-
components: ['Account/Edit', 'EmailVerification/Show'],
45-
},
46-
{
47-
label: "Logout",
48-
route: route("logout"),
49-
method: "post",
50-
condition: true,
51-
components: [],
52-
},
53-
];
54-
}
55-
5633
return [
5734
{
58-
label: "Login",
59-
route: route("login"),
35+
label: "Dashboard",
36+
route: home(),
37+
condition: true,
38+
components: ['Dashboard/Index'],
39+
},
40+
{
41+
label: "Account",
42+
route: editAccount(),
6043
condition: true,
61-
components: ['Login/Show'],
44+
components: ['Account/Edit', 'EmailVerification/Show'],
6245
},
6346
{
64-
label: "Register",
65-
route: route("register"),
47+
label: "Logout",
48+
route: LogoutController(),
49+
method: "post",
6650
condition: true,
67-
components: ['Register/Show'],
51+
components: [],
6852
},
6953
];
7054
});

resources/js/Pages/Account/Edit.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@
9090
import { ref } from "vue";
9191
import { useForm } from "@inertiajs/vue3";
9292
93+
import { update } from "@js/actions/App/Http/Controllers/AccountController";
94+
9395
const title = ref("Update Account");
9496
const props = defineProps({
9597
user: Object,
@@ -103,8 +105,9 @@
103105
});
104106
105107
const submitForm = () => {
106-
accountForm.patch(route("account.update"), {
108+
accountForm.submit(update(), {
107109
preserveScroll: true,
110+
preserveState: 'errors',
108111
});
109112
};
110113
</script>

resources/js/Pages/EmailVerification/Show.vue

+17-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@
2121
</button>
2222
</div>
2323
</div>
24+
25+
<div class="mt-6 xl:mt-10">
26+
<p class="text-center mt-3">
27+
<Link
28+
class="text-link"
29+
:href="LogoutController()"
30+
method="post"
31+
as="button"
32+
>
33+
Logout
34+
</Link>
35+
</p>
36+
</div>
2437
</div>
2538
</template>
2639

@@ -36,12 +49,14 @@
3649
import { ref } from "vue";
3750
import { router } from "@inertiajs/vue3";
3851
52+
import LogoutController from "@js/actions/App/Http/Controllers/LogoutController";
53+
import { update } from "@js/actions/App/Http/Controllers/EmailVerificationController";
54+
3955
const title = ref("Verify Your Email");
4056
4157
const resend = () => {
42-
router.post(route('verification.send'), {
58+
router.post(update().url, {
4359
preserveScroll: true,
44-
preserveState: true,
4560
});
4661
};
4762
</script>

resources/js/Pages/Login/Show.vue

+7-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
Password
3636
<Link
3737
class="text-link"
38-
:href="route('password')"
38+
:href="forgotPassword()"
3939
text="Forgot password?"
4040
/>
4141
</label>
@@ -79,7 +79,7 @@
7979
Don't have an account?
8080
<Link
8181
class="text-link"
82-
:href="route('register')"
82+
:href="register()"
8383
text="Register"
8484
/>
8585
</p>
@@ -100,6 +100,10 @@
100100
import { ref } from "vue";
101101
import { useForm } from "@inertiajs/vue3";
102102
103+
import { show as forgotPassword } from "@js/actions/App/Http/Controllers/ResetPasswordController";
104+
import { show as register } from "@js/actions/App/Http/Controllers/RegisterController";
105+
import { store } from "@js/actions/App/Http/Controllers/LoginController";
106+
103107
const props = defineProps({
104108
email: String,
105109
password: String,
@@ -116,6 +120,6 @@
116120
});
117121
118122
const submitForm = () => {
119-
loginForm.post(route("login.store"));
123+
loginForm.submit(store());
120124
};
121125
</script>

0 commit comments

Comments
 (0)