@@ 8-20 (lines=13) @@ | ||
5 | use Dimsav\Translatable\Translatable; |
|
6 | use Illuminate\Database\Eloquent\Model as Eloquent; |
|
7 | ||
8 | class CountryGuarded extends Eloquent |
|
9 | { |
|
10 | use Translatable; |
|
11 | ||
12 | public $table = 'countries'; |
|
13 | protected $fillable = []; |
|
14 | protected $guarded = ['*']; |
|
15 | ||
16 | public $translatedAttributes = ['name']; |
|
17 | ||
18 | public $translationModel = 'Dimsav\Translatable\Test\Model\CountryTranslation'; |
|
19 | public $translationForeignKey = 'country_id'; |
|
20 | } |
|
21 |
@@ 8-51 (lines=44) @@ | ||
5 | use Dimsav\Translatable\Translatable; |
|
6 | use Illuminate\Database\Eloquent\Model as Eloquent; |
|
7 | ||
8 | class CountryStrict extends Eloquent |
|
9 | { |
|
10 | use Translatable; |
|
11 | ||
12 | /** |
|
13 | * Array with the fields translated in the Translation table. |
|
14 | * |
|
15 | * @var array |
|
16 | */ |
|
17 | public $translatedAttributes = ['name']; |
|
18 | ||
19 | /** |
|
20 | * Here we set a custom model for translation. |
|
21 | * The convention would be Dimsav\Translatable\Test\Model\CountryStrictTranslation. |
|
22 | * |
|
23 | * @var string Class containing the translation |
|
24 | */ |
|
25 | public $translationModel = 'Dimsav\Translatable\Test\Model\StrictTranslation'; |
|
26 | ||
27 | /** |
|
28 | * @var string Foreign key for the translation relationship |
|
29 | */ |
|
30 | public $translationForeignKey = 'country_id'; |
|
31 | ||
32 | /** |
|
33 | * Column containing the locale in the translation table. |
|
34 | * Defaults to 'locale'. |
|
35 | * |
|
36 | * @var string |
|
37 | */ |
|
38 | public $localeKey; |
|
39 | ||
40 | public $table = 'countries'; |
|
41 | ||
42 | /** |
|
43 | * Add your translated attributes here if you want |
|
44 | * fill them with mass assignment. |
|
45 | * |
|
46 | * @var array |
|
47 | */ |
|
48 | public $fillable = ['code']; |
|
49 | ||
50 | protected $softDelete = true; |
|
51 | } |
|
52 |