• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

conedevelopment / bazar / 20694116184

04 Jan 2026 02:08PM UTC coverage: 68.615% (+4.5%) from 64.117%
20694116184

push

github

iamgergo
version

1679 of 2447 relevant lines covered (68.61%)

25.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

60.0
/src/Models/Category.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Cone\Bazar\Models;
6

7
use Cone\Bazar\Database\Factories\CategoryFactory;
8
use Cone\Bazar\Interfaces\Models\Category as Contract;
9
use Cone\Root\Traits\HasMedia;
10
use Cone\Root\Traits\InteractsWithProxy;
11
use Illuminate\Database\Eloquent\Factories\HasFactory;
12
use Illuminate\Database\Eloquent\Model;
13
use Illuminate\Database\Eloquent\Relations\BelongsTo;
14
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
15
use Illuminate\Database\Eloquent\SoftDeletes;
16

17
class Category extends Model implements Contract
18
{
19
    use HasFactory;
20
    use HasMedia;
21
    use InteractsWithProxy;
22
    use SoftDeletes;
23

24
    /**
25
     * The attributes that are mass assignable.
26
     *
27
     * @var list<string>
28
     */
29
    protected $fillable = [
30
        'description',
31
        'name',
32
        'slug',
33
    ];
34

35
    /**
36
     * The table associated with the model.
37
     *
38
     * @var string
39
     */
40
    protected $table = 'bazar_categories';
41

42
    /**
43
     * Get the proxied interface.
44
     */
45
    public static function getProxiedInterface(): string
1✔
46
    {
47
        return Contract::class;
1✔
48
    }
49

50
    /**
51
     * Create a new factory instance for the model.
52
     */
53
    protected static function newFactory(): CategoryFactory
2✔
54
    {
55
        return CategoryFactory::new();
2✔
56
    }
57

58
    /**
59
     * {@inheritdoc}
60
     */
61
    public function getMorphClass(): string
×
62
    {
63
        return static::getProxiedClass();
×
64
    }
65

66
    /**
67
     * Get the parent for the category.
68
     */
69
    public function parent(): BelongsTo
×
70
    {
71
        return $this->belongsTo(static::class, 'parent_id');
×
72
    }
73

74
    /**
75
     * Get the products for the category.
76
     */
77
    public function products(): BelongsToMany
1✔
78
    {
79
        return $this->belongsToMany(Product::getProxiedClass(), 'bazar_category_product');
1✔
80
    }
81
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc