【发布时间】:2014-09-07 21:08:45
【问题描述】:
我正在尝试从命名路由中获取 url。当我在头文件中调用方法时
<a href="{{route('cmsPage', 'thematic_areas')}}" class="dropdown-toggle" data-hover="dropdown">Thematic Areas<b class="caret"></b></a>
结果正确
http://hassaan.discover.local/page/thematic_areas
而当在 db seeder 文件中调用相同的方法时
AdminNavBar::create(array('name'=>'Thematic Area', 'link'=>route('cmsPage', 'thematic_areas'), 'parent_id'=>'0'));
结果不正确。 (从 php artisan 运行种子后存储在 db 中的 URL)
http://localhost/page/thematic_areas
我无法弄清楚为什么在播种时基本 URL 会变得不同
【问题讨论】:
-
你的 config/app.php 中的 url 是什么?
-
实际设置为 localhost。现在我已经改变了它并完美地工作。感谢您指出。
标签: php laravel laravel-4 routing seeding