hooks.js

15 lines | 339 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) {
        var d = new Date(d)
        return d.toLocaleDateString()
    })
})