Skip to content

Commit

Permalink
add withOwner on shortUrlFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
yordadev committed Jul 18, 2024
1 parent 25719cb commit b0c5d23
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Utility/Factories/ShortUrlFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
namespace YorCreative\UrlShortener\Utility\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
use YorCreative\UrlShortener\Models\ShortUrl;
use YorCreative\UrlShortener\Models\ShortUrlOwnership;
use YorCreative\UrlShortener\Services\UtilityService;
use YorCreative\UrlShortener\Traits\ShortUrlHelper;

Expand Down Expand Up @@ -85,4 +87,11 @@ public function withLink(string $link): self
];
});
}

public function withOwner(Model $model): self
{
ShortUrlOwnership::factory()->withOwner($model)->create();

return $this;
}
}

0 comments on commit b0c5d23

Please sign in to comment.