Skip to content

Commit

Permalink
Revert MorphTo into BelongsTo
Browse files Browse the repository at this point in the history
Signed-off-by: George Klincarski <[email protected]>
  • Loading branch information
gkmk authored Jan 23, 2024
1 parent 53e1ed9 commit c4cad87
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Models/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use function config;

/**
Expand Down Expand Up @@ -80,17 +79,17 @@ public function getTable(): string
/**
* @return BelongsTo<Wallet, self>
*/
public function from(): MorphTo
public function from(): BelongsTo
{
return $this->morphTo();
return $this->belongsTo(config('wallet.wallet.model', Wallet::class), 'from_id');

Check failure on line 84 in src/Models/Transfer.php

View workflow job for this annotation

GitHub Actions / phpstan

Parameter #1 $related of method Illuminate\Database\Eloquent\Model::belongsTo() expects string, mixed given.
}

/**
* @return BelongsTo<Wallet, self>
*/
public function to(): MorphTo
public function to(): BelongsTo
{
return $this->morphTo();
return $this->belongsTo(config('wallet.wallet.model', Wallet::class), 'to_id');

Check failure on line 92 in src/Models/Transfer.php

View workflow job for this annotation

GitHub Actions / phpstan

Parameter #1 $related of method Illuminate\Database\Eloquent\Model::belongsTo() expects string, mixed given.
}

/**
Expand Down

0 comments on commit c4cad87

Please sign in to comment.