mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-17 10:45:01 +00:00
fixes part 1
This commit is contained in:
@@ -37,7 +37,7 @@ class UserSetting extends Model
|
||||
/**
|
||||
* Format avatar to full url
|
||||
*/
|
||||
public function getAvatarAttribute(): array|string
|
||||
public function getAvatarAttribute(): array|null
|
||||
{
|
||||
$link = [];
|
||||
|
||||
@@ -61,12 +61,7 @@ class UserSetting extends Model
|
||||
return $link;
|
||||
}
|
||||
|
||||
// Return default avatar
|
||||
foreach (config('vuefilemanager.avatar_sizes') as $item) {
|
||||
$link[$item['name']] = url('/assets/images/default-avatar.png');
|
||||
}
|
||||
|
||||
return $link;
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getNameAttribute(): string
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Users\Resources;
|
||||
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
@@ -31,6 +32,7 @@ class UserResource extends JsonResource
|
||||
'id' => $this->id,
|
||||
'type' => 'user',
|
||||
'attributes' => [
|
||||
'color' => $this->settings->color,
|
||||
'avatar' => $this->settings->avatar,
|
||||
'email' => is_demo() ? obfuscate_email($this->email) : $this->email,
|
||||
'role' => $this->role,
|
||||
@@ -44,16 +46,16 @@ class UserResource extends JsonResource
|
||||
'settings' => new SettingsResource($this->settings),
|
||||
'favourites' => new FolderCollection($this->favouriteFolders),
|
||||
'creditCards' => new CreditCardCollection($this->creditCards),
|
||||
$this->mergeWhen($this->hasSubscription(), fn () => [
|
||||
$this->mergeWhen($this->hasSubscription(), fn() => [
|
||||
'subscription' => new SubscriptionResource($this->subscription),
|
||||
]),
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn () => [
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn() => [
|
||||
'balance' => new BalanceResource($this->balance),
|
||||
]),
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn () => [
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn() => [
|
||||
'alert' => new BillingAlertResource($this->billingAlert),
|
||||
]),
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn () => [
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn() => [
|
||||
'failedPayments' => new FailedPaymentsCollection($this->failedPayments),
|
||||
]),
|
||||
],
|
||||
@@ -65,13 +67,13 @@ class UserResource extends JsonResource
|
||||
'canCreateTeamFolder' => $this->canCreateTeamFolder(),
|
||||
'canInviteTeamMembers' => $this->canInviteTeamMembers(),
|
||||
],
|
||||
$this->mergeWhen($isFixedSubscription, fn () => [
|
||||
$this->mergeWhen($isFixedSubscription, fn() => [
|
||||
'limitations' => $this->limitations->summary(),
|
||||
]),
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn () => [
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn() => [
|
||||
'usages' => $this->getUsageEstimates(),
|
||||
]),
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn () => [
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn() => [
|
||||
'totalDebt' => [
|
||||
'formatted' => format_currency($this->failedPayments->sum('amount'), $this->subscription->plan->currency),
|
||||
'amount' => $this->failedPayments->sum('amount'),
|
||||
|
||||
@@ -84,8 +84,8 @@ class FileResource extends JsonResource
|
||||
'iso' => $this->exif->iso,
|
||||
'aperture_f_number' => $this->exif->aperture_f_number,
|
||||
'ccd_width' => $this->exif->ccd_width,
|
||||
'longitude' => format_gps_coordinates($this->exif->longitude, $this->exif->longitude_ref),
|
||||
'latitude' => format_gps_coordinates($this->exif->latitude, $this->exif->latitude_ref),
|
||||
'longitude' => formatGPSCoordinates($this->exif->longitude, $this->exif->longitude_ref),
|
||||
'latitude' => formatGPSCoordinates($this->exif->latitude, $this->exif->latitude_ref),
|
||||
],
|
||||
],
|
||||
]
|
||||
|
||||
@@ -29,6 +29,7 @@ class UploadRequestResource extends JsonResource
|
||||
'type' => 'user',
|
||||
'attributes' => [
|
||||
'name' => $this->user->settings->first_name,
|
||||
'color' => $this->user->settings->color,
|
||||
'avatar' => $this->user->settings->avatar,
|
||||
],
|
||||
],
|
||||
|
||||
+13
-12
@@ -1110,20 +1110,21 @@ if (! function_exists('replace_occurrence')) {
|
||||
}
|
||||
}
|
||||
|
||||
if(! function_exists('format_gps_coordinates')) {
|
||||
if (!function_exists('formatGPSCoordinates')) {
|
||||
/**
|
||||
* Format GPS coordinates
|
||||
*/
|
||||
function format_gps_coordinates($coordinates, $ref)
|
||||
* Format GPS coordinates
|
||||
*/
|
||||
function formatGPSCoordinates($coordinates, $ref): string|null
|
||||
{
|
||||
if($coordinates && $ref) {
|
||||
|
||||
return
|
||||
explode('/',$coordinates[0])[0] . '°' .
|
||||
explode('/', $coordinates[1])[0] . "'" .
|
||||
substr(explode(',', $coordinates[2])[0], 0, 5) / 1000 . '"' .
|
||||
$ref;
|
||||
if (!$coordinates && !$ref) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
$degrees = explode('/', $coordinates[0])[0];
|
||||
$minutes = explode('/', $coordinates[1])[0];
|
||||
$seconds = intval(substr(explode(',', $coordinates[2])[0], 0, 5)) / 100;
|
||||
|
||||
return "{$degrees}°$minutes'$seconds\"$ref";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user