tests:add tests for setting owner_id on new portfolio create

This commit is contained in:
hackerESQ
2024-10-28 16:59:58 -05:00
parent 9e6f879d16
commit 0e9bb1de0f
3 changed files with 54 additions and 6 deletions
-5
View File
@@ -27,10 +27,6 @@ class Portfolio extends Model
protected static function boot()
{
parent::boot();
static::saving(function ($portfolio) {
unset($portfolio->owner_id);
});
static::saved(function ($portfolio) {
@@ -95,7 +91,6 @@ class Portfolio extends Model
{
// enable queued jobs to create portfolios with owners
if (!auth()->user()?->id && !$this->owner_id) {
$this->attributes['owner_id'] = $value;
static::$owner_id = $value;
}
}