PHP code example of nevadskiy / laravel-translatable
1. Go to this page and download the library: Download nevadskiy/laravel-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/ */
nevadskiy / laravel-translatable example snippets
$book = new Book()
$book->translator()->set('title', 'Fifty miles', 'en')
$book->translator()->set('title', "П'ятдесят верстов", 'uk')
$book->save();
app()->setLocale('en');
echo $book->title; // Fifty miles
app()->setLocale('uk');
echo $book->title; // П'ятдесят верстов