PHP code example of aheenam / laravel-translatable
1. Go to this page and download the library: Download aheenam/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/ */
aheenam / laravel-translatable example snippets
use Illuminate\Database\Eloquent\Model;
use Aheenam\Translatable\Translatable;
class MyModel extends Model {
use Translatable;
public $translatable = ['place'];
}
// assuming $myModel is an instace of MyModel class defined above
// and the translations are set
echo $myModel->place; // returns 'Germany'
App::setLocale('de');
echo $myModel->place; // returns 'Deutschland'