Update UserObserver

This commit is contained in:
Daniel Supernault 2019-02-12 00:57:49 -07:00
parent 8de42c7862
commit 03cf26a09a
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 3 additions and 13 deletions

View file

@ -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 () {