fixed recurring route binding and scope

This commit is contained in:
Denis Duliçi
2022-06-05 14:07:00 +03:00
parent 5b3688aaac
commit 776bc44514
6 changed files with 56 additions and 26 deletions

View File

@ -595,6 +595,24 @@ class Transaction extends Model
};
}
/**
* Retrieve the model for a bound value.
*
* @param mixed $value
* @param string|null $field
* @return \Illuminate\Database\Eloquent\Model|null
*/
public function resolveRouteBinding($value, $field = null)
{
$query = $this->where('id', $value);
if (request()->route()->hasParameter('recurring_transaction')) {
$query->isRecurring();
}
return $query->firstOrFail();
}
/**
* Create a new factory instance for the model.
*