PHP code example of jangaraev / laravel-blade-cache

1. Go to this page and download the library: Download jangaraev/laravel-blade-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/ */

    

jangaraev / laravel-blade-cache example snippets



use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    // ...
    
    public function boot()
    {
        View::composer('homepage.categories', function (\Illuminate\View\View $view) {
            $view->with('records', \App\Repositories\Foo::get());
        });
        
        View::composer('components.listings', function (\Illuminate\View\View $view) {
            $view->with([
                'block_title' => __('titles.new'),
                'listings' => \App\Models\FooBar::getRecent(),
                'seeMore' => route('listings.latest')
            ]);
        });
}