2020-06-07 04:26:46 +02:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Tests\Psalm\LaravelPlugin\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
2020-06-09 19:13:12 +02:00
|
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
2020-06-07 04:26:46 +02:00
|
|
|
|
|
|
|
final class Comment extends Model
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @psalm-return BelongsTo<Post>
|
|
|
|
*/
|
|
|
|
public function post(): BelongsTo
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Post::class);
|
|
|
|
}
|
2020-06-09 19:13:12 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the owning commentable model.
|
|
|
|
*/
|
|
|
|
public function commentable(): MorphTo
|
|
|
|
{
|
|
|
|
return $this->morphTo();
|
|
|
|
}
|
2020-06-07 04:26:46 +02:00
|
|
|
}
|