pixelfed/app/Providers/AppServiceProvider.php

83 lines
1.7 KiB
PHP
Raw Normal View History

2018-04-15 23:56:48 +00:00
<?php
namespace App\Providers;
2019-02-12 08:05:43 +00:00
use App\Observers\{
2021-07-02 07:33:49 +00:00
AvatarObserver,
FollowerObserver,
2024-07-31 04:25:48 +00:00
HashtagFollowObserver,
2021-07-02 07:33:49 +00:00
LikeObserver,
NotificationObserver,
ModLogObserver,
ProfileObserver,
2022-09-13 03:26:54 +00:00
StatusHashtagObserver,
StatusObserver,
2021-07-02 07:33:49 +00:00
UserObserver,
UserFilterObserver,
2019-02-12 08:05:43 +00:00
};
2019-05-01 04:44:20 +00:00
use App\{
2021-07-02 07:33:49 +00:00
Avatar,
Follower,
2024-07-31 04:25:48 +00:00
HashtagFollow,
2021-07-02 07:33:49 +00:00
Like,
Notification,
ModLog,
Profile,
StatusHashtag,
2022-09-13 03:26:54 +00:00
Status,
2021-07-02 07:33:49 +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;
2022-11-08 01:41:25 +00:00
use Illuminate\Support\Facades\Validator;
2024-07-31 04:25:48 +00:00
use Illuminate\Database\Eloquent\Model;
2018-04-15 23:56:48 +00:00
class AppServiceProvider extends ServiceProvider
{
2021-07-02 07:33:49 +00:00
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
if(config('instance.force_https_urls', true)) {
URL::forceScheme('https');
}
2021-07-02 07:33:49 +00:00
Schema::defaultStringLength(191);
Paginator::useBootstrap();
Avatar::observe(AvatarObserver::class);
Follower::observe(FollowerObserver::class);
2024-07-31 04:25:48 +00:00
HashtagFollow::observe(HashtagFollowObserver::class);
2021-07-02 07:33:49 +00:00
Like::observe(LikeObserver::class);
Notification::observe(NotificationObserver::class);
ModLog::observe(ModLogObserver::class);
Profile::observe(ProfileObserver::class);
StatusHashtag::observe(StatusHashtagObserver::class);
User::observe(UserObserver::class);
2022-09-13 03:26:54 +00:00
Status::observe(StatusObserver::class);
2021-07-02 07:33:49 +00:00
UserFilter::observe(UserFilterObserver::class);
Horizon::auth(function ($request) {
return Auth::check() && $request->user()->is_admin;
});
2022-11-08 01:41:25 +00:00
Validator::includeUnvalidatedArrayKeys();
2024-07-31 04:25:48 +00:00
// Model::preventLazyLoading(true);
2021-07-02 07:33:49 +00:00
}
2018-06-01 23:39:45 +00:00
2021-07-02 07:33:49 +00:00
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
2018-04-15 23:56:48 +00:00
}