-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mahdi Ebrahimi
committed
Jan 21, 2018
1 parent
8f638f6
commit c4615b6
Showing
27 changed files
with
7,691 additions
and
4,974 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
use App\Article; | ||
|
||
class FeedController extends Controller { | ||
|
||
public function articles() { | ||
|
||
$feed = app()->make('feed'); | ||
|
||
$feed->setCache(1, 'laravel.feed.article'); | ||
|
||
if (!$feed->isCached()) { | ||
$articles = Article::latest()->take(10)->get(); | ||
foreach ($articles as $article) | ||
$feed->add($article->title, $article->user->name, url($article->slug), $article->created_at, strip_tags ($article->description), strip_tags ($article->body)); | ||
} | ||
|
||
return $feed->render('rss'); | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Routing\Controller; | ||
|
||
class SitemapController extends Controller { | ||
|
||
public function index() { | ||
$sitemap = app()->make('sitemap'); | ||
$sitemap->setCache('laravel.sitemap', 30); | ||
if (!$sitemap->isCached()) | ||
$sitemap->add(url('sitemap-articles'), '2012-08-25T20:10:00+02:00', '0.5', 'daily'); | ||
return $sitemap->render(); | ||
} | ||
|
||
public function articles() { | ||
$sitemap = app()->make('sitemap'); | ||
$sitemap->setCache('laravel.sitemap.articles', 30); | ||
|
||
if (!$sitemap->isCached()) { | ||
|
||
$articles = \App\Article::latest()->get(); | ||
foreach ($articles as $article) | ||
$sitemap->add(url($article->path()), '2012-08-25T20:10:00+02:00', '0.5', 'Weekly'); | ||
} | ||
|
||
return $sitemap->render(); | ||
} | ||
|
||
} |
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
Oops, something went wrong.