psalm-plugin-laravel/tests/Models/Post.php

27 lines
554 B
PHP

<?php declare(strict_types=1);
namespace Tests\Psalm\LaravelPlugin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
final class Post extends Model {
protected $table = 'posts';
/**
* @psalm-return HasMany<Comment>
*/
public function comments(): HasMany
{
return $this->hasMany(Comment::class);
}
/**
* @psalm-return MorphOne<Image>
*/
public function image(): MorphOne
{
return $this->morphOne(Image::class, 'imageable');
}
}