PHP code example of yediyuz / laravel-cloudflare-cache
1. Go to this page and download the library: Download yediyuz/laravel-cloudflare-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/ */
yediyuz / laravel-cloudflare-cache example snippets
namespace App\Http\Controllers;
use App\Http\Requests\UpdatePostRequest;
use App\Models\Post;
use Yediyuz\CloudflareCache\Facades\CloudflareCache;
class PostController extends Controller
{
public function update(Post $post, UpdatePostRequest $request)
{
$post->update($request->validated());
CloudflareCache::purgeByUrls([
route('post.show', $post->id)
]);
return back()->with('message', 'Post updated and url cache purged');
}
}