我有路线:
Route::get('feed/{type?}/{first?}/{second?}/{third?}', ['as' => 'feed', 'uses' => 'PostController@feed']);
我尝试传递URL(get):
http://localhost/feed/area/48.1486/17.1077/km
PostController中:
public function feed(Request $request)
{
switch ($request->route('type')) {
case 'area':
if (!$request->route('first') || !$request->route('second')) {
break;
}
$third = ($request->route('third')) ? $request->route('third') : 'km';
$posts = $this->post->getNumpostsArea($request,30,(float)$request->route('first'),(float)$request->route('second'),$third='km');
$feed = Feed::make();
$feed->title = siteSettings('siteName');
$feed->description = siteSettings('description');
$feed->logo = asset('/static/img/favicon.ico');
$feed->link = $request->fullUrl();
$feed->setDateFormat('carbon'); // 'datetime', 'timestamp' or 'carbon'
$feed->pubdate = $posts[0]->created_at;
$feed->lang = 'en';
$feed->setShortening(true);
$feed->setTextLimit(100);
foreach ($posts as $post) {
$feed->add($post->title . ' (' . $post->distance . $third . ')', $post->user->fullname, route('posts.main', ['id' => $post->id, 'slug' => $post->slug]), $post->approved_at, parseDown($post->description), parseDown($post->content));
}
return $feed->render('atom');
break;
...
我收到错误:
NotFoundHttpException in RouteCollection.php line 161:
你能帮助我一点点做坏事吗?想我为什么离开路线。 谢谢。
答案 0 :(得分:1)
缓存问题。没有代码问题。