| 1 | <?php |
||
| 17 | class Locale extends Model |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * {@inheritdoc} |
||
| 21 | */ |
||
| 22 | protected $table = 'locales'; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * {@inheritdoc} |
||
| 26 | */ |
||
| 27 | protected $fillable = [ |
||
| 28 | 'iso', |
||
| 29 | 'label', |
||
| 30 | 'fallback_id', |
||
| 31 | 'available_in_api', |
||
| 32 | ]; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * {@inheritdoc} |
||
| 36 | */ |
||
| 37 | protected $casts = [ |
||
| 38 | 'fallback_id' => 'integer', |
||
| 39 | 'available_in_api' => 'boolean', |
||
| 40 | ]; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Scope a query to only include locales available in API. |
||
| 44 | * |
||
| 45 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
| 46 | * @param array $args |
||
| 47 | * @return \Illuminate\Database\Eloquent\Builder |
||
| 48 | */ |
||
| 49 | public function scopeAvailableInApi($query, array $args = []) |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Locale fallback relationship. |
||
| 58 | * |
||
| 59 | * @return \Illuminate\Database\Eloquent\Relationships\BelongsTo |
||
| 60 | */ |
||
| 61 | public function fallback() |
||
| 65 | } |
||
| 66 |