1. Go to this page and download the library: Download geeksdevelop/translate 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/ */
namespace App;
use Illuminate\Database\Eloquent\Model;
use Geeksdevelop\Translate\Traits\Translate;
class Post extends Model
{
use Translate;
],
$post->setTranslate($locale, $type, $value);
$post = Post::create([...]);
#English language
$post->setTranslate('en', 'title', 'Title of the post');
#French language
$post->setTranslate('fr', 'title', 'Après le titre');
#Table translates
+----+----------------+--------------------+-----------------+------------------+
| id | locale | type | value | translable_type | translable_value |
+----+----------------+--------------------+-----------------+------------------+
| 1 | en | title | Title of the post | 1 | App\Post |
+----+----------------+--------------------+-----------------+------------------+
| 2 | fr | title | Après le titre | 1 | App\Post |
+----+----------------+--------------------+-----------------+------------------+