PHP code example of enlight / stash-view

1. Go to this page and download the library: Download enlight/stash-view 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/ */

    

enlight / stash-view example snippets


Enlight\StashView\Providers\StashViewServiceProvider::class

CACHE_DRIVER=redis

Cache::tags('views')->flush();

use Enlight\StashView\Traits\Cacheable;

class Post extends Eloquent
{
    use Cacheable;
}



namespace App;

use Enlight\StashView\Traits\Cacheable;
use Illuminate\Database\Eloquent\Model;

class Note extends Model
{
    use Cacheable;

    protected $touches = ['card'];

    public function card()
    {
        return $this->belongsTo(Card::class);
    }
}
html
@cache($card)
    <article class="Card">
        <h2>{{ $card->title }}</h2>

        <ul>
            @foreach ($card->notes as $note)
                @