mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
Update UserObserver
This commit is contained in:
parent
8de42c7862
commit
03cf26a09a
2 changed files with 3 additions and 13 deletions
|
@ -4,8 +4,7 @@ namespace App\Providers;
|
||||||
|
|
||||||
use App\Observers\UserObserver;
|
use App\Observers\UserObserver;
|
||||||
use App\User;
|
use App\User;
|
||||||
use Auth;
|
use Auth, Horizon, URL;
|
||||||
use Horizon;
|
|
||||||
use Illuminate\Support\Facades\Blade;
|
use Illuminate\Support\Facades\Blade;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
@ -43,17 +42,8 @@ class AppServiceProvider extends ServiceProvider
|
||||||
});
|
});
|
||||||
|
|
||||||
Blade::directive('prettySize', function ($expression) {
|
Blade::directive('prettySize', function ($expression) {
|
||||||
$size = intval($expression);
|
$size = \App\Util\Lexer\PrettyNumber::size($expression);
|
||||||
$precision = 0;
|
return "<?php echo '$size'; ?>";
|
||||||
$short = true;
|
|
||||||
$units = $short ?
|
|
||||||
['B', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'] :
|
|
||||||
['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
||||||
for ($i = 0; ($size / 1024) > 0.9; $i++, $size /= 1024) {
|
|
||||||
}
|
|
||||||
$res = round($size, $precision).$units[$i];
|
|
||||||
|
|
||||||
return "<?php echo '$res'; ?>";
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Blade::directive('maxFileSize', function () {
|
Blade::directive('maxFileSize', function () {
|
||||||
|
|
Loading…
Reference in a new issue