1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Model |
5
|
|
|
*/ |
6
|
|
|
namespace Hokan22\LaravelTranslator\Models; |
7
|
|
|
|
8
|
|
|
use Carbon\Carbon; |
9
|
|
|
use Illuminate\Database\Eloquent\Model; |
10
|
|
|
use Illuminate\Database\Eloquent\Builder; |
11
|
|
|
|
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class Translations |
15
|
|
|
* |
16
|
|
|
* @property int $id |
17
|
|
|
* @property string $locale |
18
|
|
|
* @property string $translation |
19
|
|
|
* @property Carbon $created_at |
20
|
|
|
* @property Carbon $updated_at |
21
|
|
|
* |
22
|
|
|
* @property-read TranslationIdentifier $text |
23
|
|
|
* |
24
|
|
|
* @method static Builder|Translations create(array $attributes = []) |
25
|
|
|
* @method static Builder|Translations findOrFail($value) |
26
|
|
|
* @method static Builder|Translations whereBody($value) |
27
|
|
|
* @method static Builder|Translations whereCommentableId($value) |
28
|
|
|
* @method static Builder|Translations whereCommentableType($value) |
29
|
|
|
* @method static Builder|Translations whereCreatedAt($value) |
30
|
|
|
* @method static Builder|Translations whereId($value) |
31
|
|
|
* @method static Builder|Translations whereUpdatedAt($value) |
32
|
|
|
* @method static Builder|Translations whereUserId($value) |
33
|
|
|
* @method static Builder|Translations whereHas($relation, \Closure $callback = null, $operator = '>=', $count = 1) |
34
|
|
|
* @method static Builder|Translations where($column, $operator = null, $value = null, $boolean = 'and') |
35
|
|
|
* |
36
|
|
|
* @package Hokan22\LaravelTranslator\Models |
37
|
|
|
* @author Alexander Viertel <[email protected]> |
38
|
|
|
* @license http://opensource.org/licenses/MIT MIT |
39
|
|
|
*/ |
40
|
|
|
class Translations extends Model |
41
|
|
|
{ |
42
|
|
|
/** @var string This is set to get more information when eloquent fails to access the model with a composite key */ |
43
|
|
|
protected $primaryKey = 'this_model_uses_composite_keys'; |
44
|
|
|
|
45
|
|
|
public $incrementing = false; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var array $fillable Database fields fillable by eloquent |
49
|
|
|
*/ |
50
|
|
|
protected $fillable = [ |
51
|
|
|
'locale', |
52
|
|
|
'translation', |
53
|
|
|
]; |
54
|
|
|
|
55
|
|
|
/** @var array $touches Set to automatically update the timestamp from the according identifier */ |
56
|
|
|
protected $touches = ['translationIdentifier']; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Return the relation to the TranslationIdentifier |
60
|
|
|
* |
61
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
62
|
|
|
*/ |
63
|
|
|
public function translationIdentifier() { |
64
|
|
|
return $this->belongsTo(TranslationIdentifier::class); |
65
|
|
|
} |
66
|
|
|
} |