Skip to content

Commit

Permalink
Merge branch 'master' into user-card-api
Browse files Browse the repository at this point in the history
  • Loading branch information
notbakaneko authored Sep 26, 2024
2 parents 5390288 + a08ae89 commit b1c327b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 7 additions & 3 deletions app/Transformers/UserCompactTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class UserCompactTransformer extends TransformerAbstract
];

const CARD_INCLUDES_PRELOAD = [
'country',
'userGroups',
];

Expand Down Expand Up @@ -193,9 +192,14 @@ public function includeCommentsCount(User $user)

public function includeCountry(User $user)
{
return $user->country === null
$countryAcronym = $user->country_acronym;
$country = $countryAcronym === null
? null
: app('countries')->byCode($countryAcronym);

return $country === null
? $this->primitive(null)
: $this->item($user->country, new CountryTransformer());
: $this->item($country, new CountryTransformer());
}

public function includeCover(User $user)
Expand Down
1 change: 0 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@
Route::get('approved', 'PaypalController@approved')->name('approved');
Route::get('declined', 'PaypalController@declined')->name('declined');
Route::post('create', 'PaypalController@create')->name('create');
Route::get('completed', 'PaypalController@completed')->name('completed');
Route::post('ipn', 'PaypalController@ipn')->name('ipn');
});

Expand Down

0 comments on commit b1c327b

Please sign in to comment.