Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
Language
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 platformInstances
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 platformChannels
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 feeds
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Models;
4
5use Database\Factories\LanguageFactory;
6use Illuminate\Database\Eloquent\Factories\HasFactory;
7use Illuminate\Database\Eloquent\Model;
8use Illuminate\Database\Eloquent\Relations\BelongsToMany;
9use Illuminate\Database\Eloquent\Relations\HasMany;
10
11class 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}