hooks.js

16 lines | 367 B Blame History Raw Download
const { hooks } = use('@adonisjs/ignitor')

hooks.after.providersBooted(() => {
    const Env = use('Env')
    const View = use('View')

    View.global('APP_URL', function () {
        return Env.get('APP_URL')
    })

    View.global('TO_LOCALE', function (d) {
        if(!d) return null 
        var d = new Date(d)
        return d.toLocaleDateString()
    })
})