code style fix

This commit is contained in:
Peter Papp
2021-04-25 09:02:00 +02:00
parent e103e61617
commit c47886fb8b
157 changed files with 2250 additions and 2583 deletions
+24 -27
View File
@@ -1,20 +1,18 @@
<?php
namespace App\Models;
use App\Notifications\ResetPassword;
use App\Services\HelperService;
use App\Services\StripeService;
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 App\Notifications\ResetPassword;
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
{
@@ -22,7 +20,7 @@ class User extends Authenticatable
protected $guarded = [
'id',
'role'
'role',
];
protected $fillable = [
@@ -34,13 +32,13 @@ class User extends Authenticatable
];
protected $casts = [
'id' => 'string',
'id' => 'string',
'email_verified_at' => 'datetime',
];
protected $appends = [
'used_capacity',
'storage'
'storage',
];
public $sortable = [
@@ -85,18 +83,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),
];
}
@@ -138,13 +135,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;
@@ -177,7 +174,7 @@ class User extends Authenticatable
]);
$record->update([
'upload' => $record->upload + $file_size
'upload' => $record->upload + $file_size,
]);
}
@@ -197,7 +194,7 @@ class User extends Authenticatable
]);
$record->update([
'download' => $record->download + $file_size
'download' => $record->download + $file_size,
]);
}