Created
January 10, 2017 09:32
-
-
Save Valonix/7a019790dd22fe345cefa877fca55f30 to your computer and use it in GitHub Desktop.
SitemapController
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use App\Category; | |
use Sitemap; | |
use App\Product; | |
class SitemapController extends Controller | |
{ | |
public function index() | |
{ | |
$products = Product::where('confirmed', '=', 1)->get(); | |
$categories = Category::orderBy('updated_at', 'desc')->get(); | |
return response()->view('sitemap.index', [ | |
'products' => $products, | |
'categories' => $categories, | |
])->header('Content-Type', 'text/xml'); | |
} | |
public function posts() | |
{ | |
$posts = Product::active()->where('confirmed', '=', 1)->get(); | |
return response()->view('sitemap.posts', [ | |
'posts' => $posts, | |
])->header('Content-Type', 'text/xml'); | |
} | |
public function categories() | |
{ | |
$categories = Category::all(); | |
return response()->view('sitemap.categories', [ | |
'categories' => $categories, | |
])->header('Content-Type', 'text/xml'); | |
} | |
public function podcasts() | |
{ | |
$podcast = Podcast::active()->orderBy('updated_at', 'desc')->get(); | |
return response()->view('sitemap.podcasts', [ | |
'podcasts' => $podcast, | |
])->header('Content-Type', 'text/xml'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment