PHP code example of bbs-lab / nova-translation

1. Go to this page and download the library: Download bbs-lab/nova-translation 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/ */

    

bbs-lab / nova-translation example snippets


'providers' => [
    // ...
    BBSLab\NovaTranslation\NovaTranslationServiceProvider::class,
],

/**
 * {@inheritdoc}
 */
public function buildSortQuery()
{
    return static::query()->locale();
}

'use_cookies' => true,

class EncryptCookies extends Middleware
{
    public function __construct(EncrypterContract $encrypter)
    {
        parent::__construct($encrypter);

        $this->except = array_merge($this->except, [
            // ...
            NovaTranslation::localeSessionKey(),
        ]);
    }
}


// app/Http/Kernel.php

protected $middleware = [
    // ...
    \BBSLab\NovaTranslation\Http\Middleware\SetLocale::class,
];

// app/Providers/NovaServiceProvider.php

public function tools()
{
    return [
        new \BBSLab\NovaTranslation\Tools\TranslationMatrix,
    ];
}

// app/Nova/Locale.php



namespace App\Nova;

use App\Helpers\StaticLabel;
use BBSLab\NovaTranslation\Resources\Locale as BaseResource;

class Locale extends BaseResource
{
    /**
     * {@inheritdoc}
     */
    public static $group = StaticLabel::GROUP_ADMINISTRATION;
}

// config/lighthouse.php

'namespaces' => [
    // ...
    'directives' => ['App\\GraphQL\\Directives', 'BBSLab\\NovaTranslation\\GraphQL\\Directives'],
],
bash
php artisan vendor:publish --provider="BBSLab\NovaTranslation\NovaTranslationServiceProvider"
bash
php artisan migrate
bash
php artisan vendor:publish --provider="BBSLab\NovaTranslation\NovaTranslationServiceProvider"