Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
50.00% |
1 / 2 |
CRAP | |
75.00% |
3 / 4 |
| PhotoCategory | |
0.00% |
0 / 1 |
|
50.00% |
1 / 2 |
3.14 | |
75.00% |
3 / 4 |
| descriptions | |
0.00% |
0 / 1 |
2.15 | |
66.67% |
2 / 3 |
|||
| photos | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| <?php | |
| namespace App; | |
| use Illuminate\Database\Eloquent\Model; | |
| use Illuminate\Database\Eloquent\Relations\HasMany; | |
| use Illuminate\Database\Eloquent\SoftDeletes; | |
| class PhotoCategory extends Model | |
| { | |
| // use soft delete | |
| use SoftDeletes; | |
| /** | |
| * Return descriptions for website gallery | |
| * @param int $language_id | |
| * @return HasMany | |
| */ | |
| public function descriptions($language_id = 0) : HasMany | |
| { | |
| if ($language_id) { | |
| return $this->hasMany(PhotoCategoryDescription::class)->where('language_id', $language_id); | |
| } | |
| return $this->hasMany(PhotoCategoryDescription::class); | |
| } | |
| /** | |
| * Return photos for category | |
| * @return HasMany | |
| */ | |
| public function photos() :HasMany | |
| { | |
| return $this->hasMany(Photo::class); | |
| } | |
| } |