mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-28 11:00:39 +00:00
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:
+17
-19
@@ -1,16 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use ByteUnits\Metric;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Scout\Searchable;
|
||||
use Kyslik\ColumnSortable\Sortable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use TeamTNT\TNTSearch\Indexer\TNTIndexer;
|
||||
use \Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Kyslik\ColumnSortable\Sortable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
/**
|
||||
* @method static whereUserId($user_id)
|
||||
@@ -23,11 +22,11 @@ class File extends Model
|
||||
public $public_access = null;
|
||||
|
||||
protected $guarded = [
|
||||
'id'
|
||||
'id',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'file_url'
|
||||
'file_url',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
@@ -35,7 +34,7 @@ class File extends Model
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'author_id'
|
||||
'author_id',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -79,7 +78,9 @@ class File extends Model
|
||||
*/
|
||||
public function getDeletedAtAttribute()
|
||||
{
|
||||
if (!$this->attributes['deleted_at']) return null;
|
||||
if (! $this->attributes['deleted_at']) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return format_date(set_time_by_user_timezone($this->attributes['deleted_at']), __t('time'));
|
||||
}
|
||||
@@ -103,13 +104,11 @@ class File extends Model
|
||||
{
|
||||
// Get thumbnail from external storage
|
||||
if ($this->attributes['thumbnail'] && ! is_storage_driver(['local'])) {
|
||||
|
||||
return Storage::temporaryUrl("files/$this->user_id/{$this->attributes['thumbnail']}", now()->addHour());
|
||||
}
|
||||
|
||||
// Get thumbnail from local storage
|
||||
if ($this->attributes['thumbnail']) {
|
||||
|
||||
// Thumbnail route
|
||||
$route = route('thumbnail', ['name' => $this->attributes['thumbnail']]);
|
||||
|
||||
@@ -132,16 +131,15 @@ class File extends Model
|
||||
{
|
||||
// Get file from external storage
|
||||
if (! is_storage_driver(['local'])) {
|
||||
|
||||
$file_pretty_name = is_storage_driver('backblaze')
|
||||
? Str::snake(mb_strtolower($this->attributes['name']))
|
||||
: get_pretty_name($this->attributes['basename'], $this->attributes['name'], $this->attributes['mimetype']);
|
||||
|
||||
$header = [
|
||||
"ResponseAcceptRanges" => "bytes",
|
||||
"ResponseContentType" => $this->attributes['mimetype'],
|
||||
"ResponseContentLength" => $this->attributes['filesize'],
|
||||
"ResponseContentRange" => "bytes 0-600/" . $this->attributes['filesize'],
|
||||
'ResponseAcceptRanges' => 'bytes',
|
||||
'ResponseContentType' => $this->attributes['mimetype'],
|
||||
'ResponseContentLength' => $this->attributes['filesize'],
|
||||
'ResponseContentRange' => 'bytes 0-600/' . $this->attributes['filesize'],
|
||||
'ResponseContentDisposition' => 'attachment; filename=' . $file_pretty_name,
|
||||
];
|
||||
|
||||
@@ -169,8 +167,8 @@ class File extends Model
|
||||
$name = Str::slug($array['name'], ' ');
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $name,
|
||||
'id' => $this->id,
|
||||
'name' => $name,
|
||||
'nameNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$name]))),
|
||||
];
|
||||
}
|
||||
@@ -207,7 +205,7 @@ class File extends Model
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($file) {
|
||||
$file->id = (string)Str::uuid();
|
||||
$file->id = (string) Str::uuid();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+13
-18
@@ -1,14 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Scout\Searchable;
|
||||
use Kyslik\ColumnSortable\Sortable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use TeamTNT\TNTSearch\Indexer\TNTIndexer;
|
||||
use \Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Kyslik\ColumnSortable\Sortable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
/**
|
||||
* @method static whereUserId(int|string|null $id)
|
||||
@@ -18,13 +17,13 @@ class Folder extends Model
|
||||
use Searchable, SoftDeletes, Sortable, HasFactory;
|
||||
|
||||
protected $guarded = [
|
||||
'id'
|
||||
'id',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'items',
|
||||
'trashed_items',
|
||||
'type'
|
||||
'type',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
@@ -32,7 +31,7 @@ class Folder extends Model
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'author_id'
|
||||
'author_id',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -65,8 +64,8 @@ class Folder extends Model
|
||||
$name = Str::slug($array['name'], ' ');
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $name,
|
||||
'id' => $this->id,
|
||||
'name' => $name,
|
||||
'nameNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$name]))),
|
||||
];
|
||||
}
|
||||
@@ -114,7 +113,9 @@ class Folder extends Model
|
||||
*/
|
||||
public function getDeletedAtAttribute()
|
||||
{
|
||||
if (!$this->attributes['deleted_at']) return null;
|
||||
if (! $this->attributes['deleted_at']) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return format_date(set_time_by_user_timezone($this->attributes['deleted_at']), __t('time'));
|
||||
}
|
||||
@@ -151,7 +152,6 @@ class Folder extends Model
|
||||
*/
|
||||
public function trashed_files()
|
||||
{
|
||||
|
||||
return $this->hasMany(File::class, 'folder_id', 'id')->withTrashed();
|
||||
}
|
||||
|
||||
@@ -211,19 +211,15 @@ class Folder extends Model
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model) {
|
||||
$model->id = (string)Str::uuid();
|
||||
$model->id = (string) Str::uuid();
|
||||
});
|
||||
|
||||
static::deleting(function ($item) {
|
||||
|
||||
if ($item->isForceDeleting()) {
|
||||
|
||||
$item->trashed_children()->each(function ($folder) {
|
||||
$folder->forceDelete();
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
$item->children()->each(function ($folder) {
|
||||
$folder->delete();
|
||||
});
|
||||
@@ -235,7 +231,6 @@ class Folder extends Model
|
||||
});
|
||||
|
||||
static::restoring(function ($item) {
|
||||
|
||||
// Restore children folders
|
||||
$item->trashed_children()->each(function ($folder) {
|
||||
$folder->restore();
|
||||
@@ -247,4 +242,4 @@ class Folder extends Model
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -7,19 +6,20 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Invoice extends Model
|
||||
{
|
||||
protected $guarded = [
|
||||
'id'
|
||||
'id',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'seller' => 'array',
|
||||
'client' => 'array',
|
||||
'bag' => 'array',
|
||||
'bag' => 'array',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function user() {
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(User::class, 'id', 'user_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\LanguageService;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Services\LanguageService;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Kyslik\ColumnSortable\Sortable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @method static whereLocale(string $param)
|
||||
@@ -20,7 +19,7 @@ class Language extends Model
|
||||
];
|
||||
|
||||
protected $guarded = [
|
||||
'id'
|
||||
'id',
|
||||
];
|
||||
|
||||
protected $keyType = 'string';
|
||||
@@ -43,7 +42,8 @@ class Language extends Model
|
||||
|
||||
resolve(LanguageService::class)
|
||||
->create_default_language_translations(
|
||||
get_setting('license') ?? 'extended', $language->locale
|
||||
get_setting('license') ?? 'extended',
|
||||
$language->locale
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -16,6 +15,6 @@ class LanguageTranslation extends Model
|
||||
public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
'value'
|
||||
'value',
|
||||
];
|
||||
}
|
||||
|
||||
+2
-3
@@ -1,10 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Kyslik\ColumnSortable\Sortable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Page extends Model
|
||||
{
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
/**
|
||||
* @method static whereName(string $string)
|
||||
@@ -13,7 +12,7 @@ class Setting extends Model
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'value', 'name'
|
||||
'value', 'name',
|
||||
];
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Share extends Model
|
||||
{
|
||||
@@ -22,7 +21,7 @@ class Share extends Model
|
||||
protected $primaryKey = 'token';
|
||||
|
||||
protected $casts = [
|
||||
'is_protected' => 'boolean'
|
||||
'is_protected' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -48,7 +47,7 @@ class Share extends Model
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($shared) {
|
||||
$shared->id = (string)Str::uuid();
|
||||
$shared->id = (string) Str::uuid();
|
||||
$shared->token = Str::random(16);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Traffic extends Model
|
||||
{
|
||||
@@ -13,7 +12,7 @@ class Traffic extends Model
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'upload',
|
||||
'download'
|
||||
'download',
|
||||
];
|
||||
|
||||
public $incrementing = false;
|
||||
@@ -28,7 +27,7 @@ class Traffic extends Model
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model) {
|
||||
$model->id = (string)Str::uuid();
|
||||
$model->id = (string) Str::uuid();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+23
-26
@@ -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,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -11,7 +10,7 @@ class UserSettings extends Model
|
||||
|
||||
protected $guarded = [
|
||||
'id',
|
||||
'storage_capacity'
|
||||
'storage_capacity',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
+3
-4
@@ -1,10 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Zip extends Model
|
||||
{
|
||||
@@ -29,7 +28,7 @@ class Zip extends Model
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model) {
|
||||
$model->id = (string)Str::uuid();
|
||||
$model->id = (string) Str::uuid();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user