Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| TemplateSubcategoryLv1 | |
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| templates | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| category | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| subcategory_lv2 | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Models; |
| 4 | |
| 5 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
| 6 | use Illuminate\Database\Eloquent\Relations\HasMany; |
| 7 | |
| 8 | class TemplateSubcategoryLv1 extends Moloquent |
| 9 | { |
| 10 | protected $table = 'template_subcategory_lv1'; |
| 11 | |
| 12 | protected $fillable = [ |
| 13 | 'parent_category_id', 'child_category_id', 'name', 'slug', |
| 14 | ]; |
| 15 | |
| 16 | public function templates(): HasMany |
| 17 | { |
| 18 | return $this->hasMany(Template::class, 'subcategory_lv1_id'); |
| 19 | } |
| 20 | |
| 21 | public function category(): BelongsTo |
| 22 | { |
| 23 | return $this->belongsTo(TemplateCategory::class, 'parent_category_id'); |
| 24 | } |
| 25 | |
| 26 | public function subcategory_lv2(): HasMany |
| 27 | { |
| 28 | return $this->hasMany(TemplateSubcategoryLv2::class, 'parent_sub_category_id'); |
| 29 | } |
| 30 | } |