PHP code example of fewfar / laravel-frontend

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

    

fewfar / laravel-frontend example snippets

sh
php artisan vendor:publish --provider="FewFar\LaravelFrontend\ServiceProvider"



namespace App\Providers;

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

use FewFar\LaravelFrontend\PageDefaultsViewComposer as BaseViewComposer;

class PageDefaultsViewComposer extends BaseViewComposer
{
    /**
     * Gets frontend default variables.
     *
     * @return array
     */
    protected function defaultsForFrontend()
    {
        return [
            'page' => [
                'title' => 'HTML Meta Title',
                'description' => 'HTML Meta Description',
                ...
            ],
        ];
    }

    /**
     * Gets application default variables (i.e. ones used when not in the
     * frontend templates.)
     *
     * @return array
     */
    protected function defaultsForApp()
    {
        return [
            'page' => [
                'title' => config('app.name'),
                ...
            ],
        ];
    }
}