PHP code example of siteorigin / laravel-page-cache
1. Go to this page and download the library: Download siteorigin/laravel-page-cache library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
siteorigin / laravel-page-cache example snippets
Route::get('/', function () {
return view('welcome');
})->name('home')->middleware('cache.headers:public;max_age=2628000;etag', 'page-cache');
public function index(Request $request)
{
$articles = Article::simplePaginate(5);
return view('articles.index', [
'articles' => $articles->count() ? $articles : abort(404)
]);
}