Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
TemplateSubcategoryLv1
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 templates
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 category
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 subcategory_lv2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Http\Models;
4
5use Illuminate\Database\Eloquent\Relations\BelongsTo;
6use Illuminate\Database\Eloquent\Relations\HasMany;
7
8class 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}