Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
50.00% |
1 / 2 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| Badge | |
50.00% |
1 / 2 |
|
50.00% |
1 / 2 |
2.50 | |
0.00% |
0 / 1 |
| casts | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| achievements | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Models; |
| 4 | |
| 5 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 6 | use Illuminate\Database\Eloquent\Model; |
| 7 | use Illuminate\Database\Eloquent\Relations\HasMany; |
| 8 | |
| 9 | class Badge extends Model |
| 10 | { |
| 11 | use HasFactory; |
| 12 | |
| 13 | protected $fillable = ['name', 'slug', 'description', 'icon', 'color', 'sort_order', 'metadata']; |
| 14 | |
| 15 | protected function casts(): array |
| 16 | { |
| 17 | return ['metadata' => 'array']; |
| 18 | } |
| 19 | |
| 20 | public function achievements(): HasMany { return $this->hasMany(GamificationAchievement::class); } |
| 21 | } |