Route cache

This commit is contained in:
2021-01-30 17:17:47 +05:00
parent 1d4ac145a4
commit c0ae632fdc

View File

@@ -8,6 +8,7 @@ use App\Http\Controllers\API\TopicsAPIController;
use App\Http\Controllers\API\MyListAPIController;
use App\Http\Controllers\API\NewsLetterAPIController;
use App\Article;
use Illuminate\Support\Facades\Cache;
/*
|--------------------------------------------------------------------------
@@ -37,7 +38,8 @@ Route::post('newsletter/subscribe', [NewsLetterAPIController::class, 'store'])->
Route::get('/ping/{source}', \API\MonitorAPIController::class);
Route::get('/latest/webhook', function(){
Route::get('/latest/webhook', function () {
return Cache::remember('webhooks.latest', 60, function () {
return Article::latest()->limit(20)->get()->transform(function ($article) {
return [
"id" => $article->id,
@@ -50,4 +52,5 @@ Route::get('/latest/webhook', function(){
"link" => "https://karudhaas.net/article/{$article->source->slug}/{$article->guid}"
];
});
});
});