taktik - laravel
This commit is contained in:
32
app/Models/Category.php
Normal file
32
app/Models/Category.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user