Skip to content

Commit 99b6822

Browse files
committed
Fixes tracing modal
1 parent 21a7947 commit 99b6822

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/Models/ShortUrlTracing.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ShortUrlTracing extends Model
1414
/**
1515
* @var bool
1616
*/
17-
public $incrementing = true;
17+
public $incrementing = false;
1818

1919
/**
2020
* @var string
@@ -24,7 +24,7 @@ class ShortUrlTracing extends Model
2424
/**
2525
* @var string
2626
*/
27-
protected $primaryKey = 'id';
27+
protected $primaryKey = 'short_url_id';
2828

2929
/**
3030
* @var string[]

src/Repositories/UrlRepository.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,16 @@ public static function findOwnershipUrls(string $owner_type, int $owner_id): Col
5656
public static function getOwnershipUrlsCount(string $owner_type, int $owner_id): int
5757
{
5858
try {
59-
return ShortUrl::whereIn('id', function ($query) use ($owner_type, $owner_id) {
60-
$query->from('short_url_ownerships');
61-
$query->where([
62-
'ownerable_type' => $owner_type,
63-
'ownerable_id' => $owner_id,
64-
]);
65-
$query->select('short_url_id');
66-
})->count();
59+
return ShortUrl::query()
60+
->whereIn('id', function ($query) use ($owner_type, $owner_id) {
61+
$query->from('short_url_ownerships');
62+
$query->where([
63+
'ownerable_type' => $owner_type,
64+
'ownerable_id' => $owner_id,
65+
]);
66+
$query->select('short_url_id');
67+
})
68+
->count();
6769
} catch (Exception $exception) {
6870
throw new UrlRepositoryException($exception->getMessage());
6971
}
@@ -94,7 +96,7 @@ public static function findByPlainText(string $plain_text): ShortUrl
9496
{
9597
try {
9698
return ShortUrl::where(
97-
'plain_text', 'like', $plain_text.'%'
99+
'plain_text', 'like', $plain_text . '%'
98100
)->with(self::defaultWithRelationship())->firstOrFail();
99101
} catch (Exception $exception) {
100102
throw new UrlRepositoryException($exception->getMessage());

0 commit comments

Comments
 (0)