PHP code example of hkp22 / cache-laraview-fragments
1. Go to this page and download the library: Download hkp22/cache-laraview-fragments 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/ */
hkp22 / cache-laraview-fragments example snippets
'providers' => [
Hkp22\CacheLaraViewFragments\CacheLaraViewFragmentServiceProvider::class,
],
Cache::tags('views')->flush();
use Hkp22\CacheLaraViewFragments\Cacheable;
class Post extends Eloquent
{
use Cacheable;
}
namespace App;
use Hkp22\CacheLaraViewFragments\Cacheable;
use Illuminate\Database\Eloquent\Model;
class Comment extends Model
{
use Cacheable;
protected $touches = ['post'];
public function post()
{
return $this->belongsTo(Post::class);
}
}