Larave框架如何定义模板常量?

比如我要定义一个_DOMAIN_常量等于http://example.com,然后以后在模板中写链接就可以使用类似href="{ DOMAIN }/index.php"的方式,请问要如何定义模板常量呢?

JellyBool

直接写’href=/index.php’就可以了

sodasix

生成一个 controller 基类, 然后其他的controller 继承这个 controller, 在基类中 \View::share(‘domain’, ‘test’)

view 中 { $domain }

justtest

可以在 serviceprovider 中定义 const XXX ,然后模版中调用试试。
当然用 view 的 share 和 composer 也是一种方法。