Skip to content

Commit

Permalink
simulate test case
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia committed Jan 17, 2025
1 parent a27b7c5 commit f3f3a95
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/Utils/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests\Utils\Models;

use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
Expand Down Expand Up @@ -48,6 +49,15 @@ final class Post extends Model
use Searchable;
use SoftDeletes;

/** @return Attribute<int, int> */
protected function id(): Attribute
{
return Attribute::make(
get: fn (mixed $_, array $attributes): int => $attributes[$this->primaryKey],
set: fn (int $id) => [$this->primaryKey => $id],
);
}

/** @return \Illuminate\Database\Eloquent\Relations\MorphMany<\Tests\Utils\Models\Activity, $this> */
public function activity(): MorphMany
{
Expand Down

0 comments on commit f3f3a95

Please sign in to comment.