1. Go to this page and download the library: Download paulund/content-markdown 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/ */
Route::get('/content/{slug}', function ($slug) {
$content = Content::slug($slug)->first();
return response()->json($content);
})->middleware(\Paulund\ContentMarkdown\Http\Middleware\CacheResponse::class);
/*
|--------------------------------------------------------------------------
| Cache Configuration
|--------------------------------------------------------------------------
|
| Configure the Cache for your content. This is enabled by middleware
|
*/
'cache' => [
/**
* Enable or disable the cache
*/
'enabled' => env('CONTENT_CACHE_ENABLED', true),
/**
* Cache store to use
*/
'store' => env('CONTENT_CACHE_STORE', 'file'),
/**
* Seconds to cache the content for 3600 = 1 hour
*/
'ttl' => env('CONTENT_CACHE_TTL', 3600),
]