Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
60.00% |
3 / 5 |
|
33.33% |
1 / 3 |
CRAP | |
0.00% |
0 / 1 |
| Language | |
60.00% |
3 / 5 |
|
33.33% |
1 / 3 |
3.58 | |
0.00% |
0 / 1 |
| platformInstances | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| platformChannels | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| feeds | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Models; |
| 4 | |
| 5 | use Database\Factories\LanguageFactory; |
| 6 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 7 | use Illuminate\Database\Eloquent\Model; |
| 8 | use Illuminate\Database\Eloquent\Relations\BelongsToMany; |
| 9 | use Illuminate\Database\Eloquent\Relations\HasMany; |
| 10 | |
| 11 | class Language extends Model |
| 12 | { |
| 13 | /** @use HasFactory<LanguageFactory> */ |
| 14 | use HasFactory; |
| 15 | |
| 16 | protected $fillable = [ |
| 17 | 'short_code', |
| 18 | 'name', |
| 19 | 'native_name', |
| 20 | 'is_active' |
| 21 | ]; |
| 22 | |
| 23 | protected $casts = [ |
| 24 | 'is_active' => 'boolean' |
| 25 | ]; |
| 26 | |
| 27 | /** |
| 28 | * @return BelongsToMany<PlatformInstance, $this> |
| 29 | */ |
| 30 | public function platformInstances(): BelongsToMany |
| 31 | { |
| 32 | return $this->belongsToMany(PlatformInstance::class) |
| 33 | ->withPivot(['platform_language_id', 'is_default']) |
| 34 | ->withTimestamps(); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * @return HasMany<PlatformChannel, $this> |
| 39 | */ |
| 40 | public function platformChannels(): HasMany |
| 41 | { |
| 42 | return $this->hasMany(PlatformChannel::class); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * @return HasMany<Feed, $this> |
| 47 | */ |
| 48 | public function feeds(): HasMany |
| 49 | { |
| 50 | return $this->hasMany(Feed::class); |
| 51 | } |
| 52 | } |