Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
33.33% |
1 / 3 |
CRAP | |
33.33% |
1 / 3 |
| Article | |
0.00% |
0 / 1 |
|
33.33% |
1 / 3 |
5.67 | |
33.33% |
1 / 3 |
| descriptions | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| category | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| photos | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| <?php | |
| namespace App; | |
| use Illuminate\Database\Eloquent\Model; | |
| use Illuminate\Database\Eloquent\Relations\BelongsTo; | |
| use Illuminate\Database\Eloquent\Relations\HasMany; | |
| use Illuminate\Database\Eloquent\SoftDeletes; | |
| /** | |
| * @property mixed id | |
| */ | |
| class Article extends Model | |
| { | |
| //use soft delete | |
| use SoftDeletes; | |
| protected $fillable = [ | |
| 'image', | |
| 'video', | |
| 'video_type', | |
| 'category_id', | |
| 'user_id', | |
| 'visit_counts' | |
| ]; | |
| /** | |
| * Return descriptions for article | |
| * @return HasMany | |
| */ | |
| public function descriptions() : HasMany | |
| { | |
| return $this->hasMany(ArticleDescription::class); | |
| } | |
| /** | |
| * Return category for article | |
| * @return BelongsTo | |
| */ | |
| public function category() :BelongsTo | |
| { | |
| return $this->belongsTo(Category::class); | |
| } | |
| /** | |
| * Return other photos for article | |
| * @return HasMany | |
| */ | |
| public function photos () :HasMany | |
| { | |
| return $this->hasMany(ArticlePhoto::class); | |
| } | |
| } |