2018-04-15 23:56:48 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2019-02-12 08:05:43 +00:00
|
|
|
use App\Observers\{
|
|
|
|
AvatarObserver,
|
2019-05-01 04:44:20 +00:00
|
|
|
NotificationObserver,
|
2020-02-22 04:00:00 +00:00
|
|
|
ModLogObserver,
|
2019-07-01 04:39:00 +00:00
|
|
|
StatusHashtagObserver,
|
2019-09-04 01:30:39 +00:00
|
|
|
UserObserver,
|
|
|
|
UserFilterObserver,
|
2019-02-12 08:05:43 +00:00
|
|
|
};
|
2019-05-01 04:44:20 +00:00
|
|
|
use App\{
|
|
|
|
Avatar,
|
|
|
|
Notification,
|
2020-02-22 04:00:00 +00:00
|
|
|
ModLog,
|
2019-07-01 04:39:00 +00:00
|
|
|
StatusHashtag,
|
2019-09-04 01:30:39 +00:00
|
|
|
User,
|
|
|
|
UserFilter
|
2019-05-01 04:44:20 +00:00
|
|
|
};
|
2019-02-12 07:57:49 +00:00
|
|
|
use Auth, Horizon, URL;
|
2018-05-22 23:58:48 +00:00
|
|
|
use Illuminate\Support\Facades\Blade;
|
2018-06-01 23:39:45 +00:00
|
|
|
use Illuminate\Support\Facades\Schema;
|
2018-04-15 23:56:48 +00:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
2020-12-13 21:15:30 +00:00
|
|
|
use Illuminate\Pagination\Paginator;
|
2018-04-15 23:56:48 +00:00
|
|
|
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Bootstrap any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
2019-02-24 19:16:18 +00:00
|
|
|
URL::forceScheme('https');
|
2018-06-01 23:39:45 +00:00
|
|
|
Schema::defaultStringLength(191);
|
|
|
|
|
2020-12-13 21:15:30 +00:00
|
|
|
Paginator::useBootstrap();
|
|
|
|
|
2019-02-12 08:05:43 +00:00
|
|
|
Avatar::observe(AvatarObserver::class);
|
2019-05-01 04:44:20 +00:00
|
|
|
Notification::observe(NotificationObserver::class);
|
2020-02-22 04:00:00 +00:00
|
|
|
ModLog::observe(ModLogObserver::class);
|
2019-07-01 04:39:00 +00:00
|
|
|
StatusHashtag::observe(StatusHashtagObserver::class);
|
2018-05-22 23:58:48 +00:00
|
|
|
User::observe(UserObserver::class);
|
2019-09-04 01:30:39 +00:00
|
|
|
UserFilter::observe(UserFilterObserver::class);
|
2018-05-22 23:58:48 +00:00
|
|
|
|
|
|
|
Horizon::auth(function ($request) {
|
|
|
|
return Auth::check() && $request->user()->is_admin;
|
|
|
|
});
|
|
|
|
|
2018-08-28 03:07:36 +00:00
|
|
|
Blade::directive('prettyNumber', function ($expression) {
|
2020-12-13 21:15:30 +00:00
|
|
|
$num = \App\Util\Lexer\PrettyNumber::convert($expression);
|
2018-05-22 23:58:48 +00:00
|
|
|
return "<?php echo $num; ?>";
|
|
|
|
});
|
|
|
|
|
2018-08-28 03:07:36 +00:00
|
|
|
Blade::directive('prettySize', function ($expression) {
|
2019-02-12 07:57:49 +00:00
|
|
|
$size = \App\Util\Lexer\PrettyNumber::size($expression);
|
|
|
|
return "<?php echo '$size'; ?>";
|
2018-05-22 23:58:48 +00:00
|
|
|
});
|
2018-06-02 22:53:35 +00:00
|
|
|
|
2018-08-28 03:07:36 +00:00
|
|
|
Blade::directive('maxFileSize', function () {
|
|
|
|
$value = config('pixelfed.max_photo_size');
|
|
|
|
|
|
|
|
return \App\Util\Lexer\PrettyNumber::size($value, true);
|
2018-06-02 22:53:35 +00:00
|
|
|
});
|
2018-04-15 23:56:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
}
|