Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

280
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!