Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

282
Vistas
Laravel - Inertia - Vue: Data will not response correct

I have a Vue layout component in which I implement several other Vue components. Among other things also the header. In the header I implement another component called Notification.

I want that when rendering from my header, a get request is made to a specific route and the controller returns data & stores it in the props.notificationdata.

The problem I am having is that I am not getting the data back.

  1. with a simple return $data it is not inertia compliant.
  2. returning a rendering is also not possible, because it is not a main component that is rendered directly otherwise.
  3. according to the Laravel docs simply a return back()->with();.

Unfortunately I can't find the correct solution....

Here is my Request:

let props = defineProps({
    notificationdata: Object,
});

function GetNotificationData() {
    props.notificationdata = Inertia.get('/account/user/notifications',
        { preserveState: false, preserveScroll: true }
    );
}

Here is the php Function:

static function getUserNotifications() {
    $query = Notification::query();
    $query->where('state', 0);
    $query->orderBy('created_at', 'DESC');
    $data = $query->get();

    return back()->with(['notificationdata' => $data]);
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda