Skip to content

Commit

Permalink
return click model
Browse files Browse the repository at this point in the history
  • Loading branch information
yordadev committed Oct 10, 2024
1 parent 2d7fa30 commit 930b3f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Repositories/ClickRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public static function findById(int $id, array $with = []): ShortUrlClick
/**
* @throws UrlRepositoryException
*/
public static function createClick(int $short_url_id, int $location_id, int $outcome_id, array $headers): void
public static function createClick(int $short_url_id, int $location_id, int $outcome_id, array $headers): ShortUrlClick
{
try {
ShortUrlClick::create([
return ShortUrlClick::create([
'short_url_id' => $short_url_id,
'location_id' => $location_id,
'outcome_id' => $outcome_id,
Expand Down
8 changes: 4 additions & 4 deletions src/Services/ClickService.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ class ClickService
/**
* @throws ClickServiceException
*/
public static function track(string $identifier, string $request_ip, int $outcome_id, ?string $domain = null, array $headers = []): void
public static function track(string $identifier, string $request_ip, int $outcome_id, ?string $domain = null, array $headers = []): ShortUrlClick
{
$request_ip = config('location.testing.enabled') ? config('location.testing.ip') : $request_ip;

try {
ClickRepository::createClick(
return ClickRepository::createClick(
UrlRepository::findByDomainIdentifier($domain, $identifier)->id,
LocationRepository::findOrCreateLocationRecord(
! config('location.testing.enabled')
Expand All @@ -74,12 +74,12 @@ public static function track(string $identifier, string $request_ip, int $outcom
/**
* @throws ClickServiceException
*/
public static function trackWithoutLookup(string $identifier, string $request_ip, int $outcome_id, ?string $domain = null, array $headers = []): void
public static function trackWithoutLookup(string $identifier, string $request_ip, int $outcome_id, ?string $domain = null, array $headers = []): ShortUrlClick
{
$request_ip = config('location.testing.enabled') ? config('location.testing.ip') : $request_ip;

try {
ClickRepository::createClick(
return ClickRepository::createClick(
UrlRepository::findByDomainIdentifier($domain, $identifier)->id,
LocationRepository::findOrCreateLocationRecord(
LocationRepository::locationUnknown($request_ip)
Expand Down

0 comments on commit 930b3f0

Please sign in to comment.