Certificate manager built on Laravel 13, Livewire 4, and Flux. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
36 lines
925 B
PHP
36 lines
925 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Concerns\OwnedByUser;
|
|
use App\Models\Scopes\OwnedByUserScope;
|
|
use Database\Factories\CategoryFactory;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Attributes\ScopedBy;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $user_id
|
|
* @property string $name
|
|
* @property Carbon|null $created_at
|
|
* @property Carbon|null $updated_at
|
|
*/
|
|
#[Fillable(['name'])]
|
|
#[ScopedBy(OwnedByUserScope::class)]
|
|
class Category extends Model
|
|
{
|
|
/** @use HasFactory<CategoryFactory> */
|
|
use HasFactory, OwnedByUser;
|
|
|
|
/**
|
|
* @return HasMany<Certificate, $this>
|
|
*/
|
|
public function certificates(): HasMany
|
|
{
|
|
return $this->hasMany(Certificate::class);
|
|
}
|
|
}
|