79470105

Date: 2025-02-26 14:44:02
Score: 0.5
Natty:
Report link

I did this

return redirect()->back()->with('success', 'Saved successfully.'); //controller

//vue
<script setup> import { ref, computed, onMounted, onBeforeUnmount } from 'vue'; import { Link, router, useForm, usePage } from '@inertiajs/vue3';const props = defineProps({ user: Object, userRole: String, });const page = usePage(); const successMessage = computed(() => page.props.flash.success); const errorMessage = computed(() => page.props.flash.error);

<div v-if="successMessage" class="text-green-500 text-sm"> //template
     {{ successMessage }}
</div>
<div v-if="errorMessage" class="text-red-500 text-sm">
     {{ errorMessage }}
</div>

The only problem with mine is that success is not included in middleware, I added it and it's working properly

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: user29810284