33 lines
669 B
PHP
33 lines
669 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\CarbonInterface;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property string $name
|
|
* @property CarbonInterface $created_at
|
|
* @property CarbonInterface $updated_at
|
|
*/
|
|
class Category extends Model
|
|
{
|
|
/** @use HasFactory<\Database\Factories\CategoryFactory> */
|
|
use HasFactory;
|
|
|
|
protected $fillable = ['name'];
|
|
|
|
/**
|
|
* @return HasMany<Post, $this>
|
|
*/
|
|
public function posts(): HasMany
|
|
{
|
|
return $this->hasMany(Post::class);
|
|
}
|
|
}
|