Merge remote-tracking branch 'origin/master' into oasis

# Conflicts:
#	app/Console/Commands/SetupDevEnvironment.php
#	app/Console/Kernel.php
#	app/Http/Resources/InvoiceResource.php
#	app/Http/Resources/UserResource.php
#	app/Models/User.php
#	composer.lock
#	config/app.php
#	config/custom-language-translations.php
#	config/language-translations.php
#	public/chunks/admin.js
#	public/chunks/app-language.js
#	public/chunks/dashboard.js
#	public/chunks/files.js
#	public/chunks/files~chunks/shared-files~chunks/shared/file-browser.js
#	public/chunks/files~chunks/shared-files~chunks/shared/file-browser~chunks/shared/single-file.js
#	public/chunks/invoices.js
#	public/chunks/pages.js
#	public/chunks/plan-subscribers.js
#	public/chunks/plans.js
#	public/chunks/platform.js
#	public/chunks/settings-invoices.js
#	public/chunks/settings-payment-methods.js
#	public/chunks/settings-subscription.js
#	public/chunks/shared-files.js
#	public/chunks/shared.js
#	public/chunks/shared/file-browser.js
#	public/chunks/user-invoices.js
#	public/chunks/user-subscription.js
#	public/chunks/users.js
#	public/js/main.js
#	public/mix-manifest.json
#	resources/js/components/FilesView/FileItemGrid.vue
#	resources/js/components/FilesView/FileItemList.vue
This commit is contained in:
Peter Papp
2021-04-29 11:06:14 +02:00
166 changed files with 2945 additions and 2876 deletions

View File

@@ -2,20 +2,18 @@
namespace App\Models;
use App\Notifications\ResetPassword;
use App\Services\HelperService;
use App\Services\StripeService;
use App\Traits\Oasis;
use ByteUnits\Metric;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Laravel\Cashier\Billable;
use Kyslik\ColumnSortable\Sortable;
use App\Services\HelperService;
use App\Services\StripeService;
use Laravel\Sanctum\HasApiTokens;
use Kyslik\ColumnSortable\Sortable;
use Illuminate\Support\Facades\Storage;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
@@ -25,7 +23,7 @@ class User extends Authenticatable
protected $guarded = [
'id',
'role'
'role',
];
protected $fillable = [
@@ -37,13 +35,13 @@ class User extends Authenticatable
];
protected $casts = [
'id' => 'string',
'id' => 'string',
'email_verified_at' => 'datetime',
];
protected $appends = [
'used_capacity',
'storage'
'storage',
];
public $sortable = [
@@ -88,18 +86,17 @@ class User extends Authenticatable
$is_storage_limit = $storage_limitation ? $storage_limitation : 1;
// Get user storage usage
if (!$is_storage_limit) {
if (! $is_storage_limit) {
return [
'used' => $this->used_capacity,
'used' => $this->used_capacity,
'used_formatted' => Metric::bytes($this->used_capacity)->format(),
];
}
return [
'used' => (float)get_storage_fill_percentage($this->used_capacity, $this->settings->storage_capacity),
'used_formatted' => get_storage_fill_percentage($this->used_capacity, $this->settings->storage_capacity) . '%',
'capacity' => $this->settings->storage_capacity,
'used' => (float) get_storage_fill_percentage($this->used_capacity, $this->settings->storage_capacity),
'used_formatted' => get_storage_fill_percentage($this->used_capacity, $this->settings->storage_capacity) . '%',
'capacity' => $this->settings->storage_capacity,
'capacity_formatted' => format_gigabytes($this->settings->storage_capacity),
];
}
@@ -141,13 +138,13 @@ class User extends Authenticatable
public function setBilling($billing)
{
$this->settings()->update([
'address' => $billing['billing_address'],
'city' => $billing['billing_city'],
'country' => $billing['billing_country'],
'name' => $billing['billing_name'],
'address' => $billing['billing_address'],
'city' => $billing['billing_city'],
'country' => $billing['billing_country'],
'name' => $billing['billing_name'],
'phone_number' => $billing['billing_phone_number'],
'postal_code' => $billing['billing_postal_code'],
'state' => $billing['billing_state'],
'postal_code' => $billing['billing_postal_code'],
'state' => $billing['billing_state'],
]);
return $this->settings;
@@ -180,7 +177,7 @@ class User extends Authenticatable
]);
$record->update([
'upload' => $record->upload + $file_size
'upload' => $record->upload + $file_size,
]);
}
@@ -200,7 +197,7 @@ class User extends Authenticatable
]);
$record->update([
'download' => $record->download + $file_size
'download' => $record->download + $file_size,
]);
}