init
This commit is contained in:
49
app/Models/Category.php
Normal file
49
app/Models/Category.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Category extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'type',
|
||||
'name',
|
||||
'slug',
|
||||
'description',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
public function tools(): HasMany
|
||||
{
|
||||
return $this->hasMany(Tool::class);
|
||||
}
|
||||
|
||||
public function models(): HasMany
|
||||
{
|
||||
return $this->hasMany(AiModel::class);
|
||||
}
|
||||
|
||||
public function articles(): HasMany
|
||||
{
|
||||
return $this->hasMany(Article::class);
|
||||
}
|
||||
|
||||
public function guides(): HasMany
|
||||
{
|
||||
return $this->hasMany(Guide::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user