1. Go to this page and download the library: Download spatie/nova-translatable 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/ */
spatie / nova-translatable example snippets
public function fields(Request $request)
{
return [
ID::make()->sortable(),
Translatable::make([
Text::make('title'),
Trix::make('text'),
]),
];
}
// in any service provider
\Spatie\NovaTranslatable\Translatable::defaultLocales(['en', 'fr']);
public function fields(Request $request)
{
return [
ID::make()->sortable(),
Translatable::make([
Text::make('title'),
Trix::make('text'),
]),
];
}
/**
* The columns that should be searched.
*
* @var array
*/
public static $search = [
'id', 'name->en', 'name->fr',
];