@@ -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