Error on return data from Database.raw('')

async free({ view }) {

    //const free = await Service.query().where('status', '=', 'Pendente').fetch()

    const free = await DB.raw('SELECT * FROM services as s INNER JOIN addresses as a ON s.address_id = GROUP BY s.created_at')

    return view.render('dashboard', { services: free })



On view in @each(item in services) the value just return undefined

Can you share view code and part of free as JSON?

You should return { services: free.rows }

1 Like