1. Go to this page and download the library: Download pictastudio/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/ */
pictastudio / translatable example snippets
use Illuminate\Database\Eloquent\Model;
use PictaStudio\Translatable\Contracts\Translatable as TranslatableContract;
use PictaStudio\Translatable\Translatable;
class Post extends Model implements TranslatableContract
{
use Translatable;
public array $translatedAttributes = ['title', 'summary'];
protected $fillable = [
'slug',
'title',
'summary',
];
}
$post = Post::create([
'slug' => 'welcome',
'title:en' => 'Welcome',
'title:it' => 'Benvenuto',
'summary:en' => 'A short intro',
]);
$post = Post::create([
'slug' => 'roadmap',
'en' => [
'title' => 'Roadmap',
'summary' => 'Where the product is going.',
],
'it' => [
'title' => 'Tabella di marcia',
'summary' => 'Dove sta andando il prodotto.',
],
]);