first commit
This commit is contained in:
32
app/Providers/AppServiceProvider.php
Normal file
32
app/Providers/AppServiceProvider.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App;
|
||||
use App\Models\Property;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Laravel\Tinker\TinkerServiceProvider;
|
||||
use Settings;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Property::loadMorphMap();
|
||||
config(['app.timezone' => Settings::scope('core')->get('timezone', date_default_timezone_get())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
if (config('app.debug') && App::environment(['local', 'staging'])) {
|
||||
$this->app->register(TelescopeServiceProvider::class);
|
||||
$this->app->register(TinkerServiceProvider::class);
|
||||
}
|
||||
}
|
||||
}
|
||||
29
app/Providers/AttachmentServiceProvider.php
Normal file
29
app/Providers/AttachmentServiceProvider.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Contracts\AttachmentService as AttachmentServiceContract;
|
||||
use App\Helpers\AttachmentHelper;
|
||||
use App\Services\AttachmentService;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AttachmentServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->bind(AttachmentServiceContract::class, AttachmentService::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
// TODO: [ ] check if we can add more from Cattr modules
|
||||
Relation::morphMap(AttachmentHelper::ABLE_BY);
|
||||
}
|
||||
}
|
||||
51
app/Providers/AuthServiceProvider.php
Normal file
51
app/Providers/AuthServiceProvider.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\Invitation;
|
||||
use App\Models\Priority;
|
||||
use App\Models\Project;
|
||||
use App\Models\ProjectGroup;
|
||||
use App\Models\Status;
|
||||
use App\Models\Task;
|
||||
use App\Models\TaskComment;
|
||||
use App\Models\TimeInterval;
|
||||
use App\Models\User;
|
||||
use App\Policies\InvitationPolicy;
|
||||
use App\Policies\PriorityPolicy;
|
||||
use App\Policies\ProjectGroupPolicy;
|
||||
use App\Policies\ProjectPolicy;
|
||||
use App\Policies\StatusPolicy;
|
||||
use App\Policies\TaskCommentPolicy;
|
||||
use App\Policies\TaskPolicy;
|
||||
use App\Policies\TimeIntervalPolicy;
|
||||
use App\Policies\UserPolicy;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The policy mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $policies = [
|
||||
ProjectGroup::class => ProjectGroupPolicy::class,
|
||||
Project::class => ProjectPolicy::class,
|
||||
Task::class => TaskPolicy::class,
|
||||
User::class => UserPolicy::class,
|
||||
TimeInterval::class => TimeIntervalPolicy::class,
|
||||
Priority::class => PriorityPolicy::class,
|
||||
Status::class => StatusPolicy::class,
|
||||
Invitation::class => InvitationPolicy::class,
|
||||
TaskComment::class => TaskCommentPolicy::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerPolicies();
|
||||
}
|
||||
}
|
||||
15
app/Providers/BroadcastServiceProvider.php
Normal file
15
app/Providers/BroadcastServiceProvider.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function boot(): void
|
||||
{
|
||||
Broadcast::routes(['middleware' => ['auth:sanctum']]);
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
||||
36
app/Providers/CatEventServiceProvider.php
Normal file
36
app/Providers/CatEventServiceProvider.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Contracts\Queue\Factory as QueueFactoryContract;
|
||||
use Illuminate\Contracts\Support\DeferrableProvider;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use CatEvent;
|
||||
use App\Observers\AttachmentObserver;
|
||||
|
||||
class CatEventServiceProvider extends ServiceProvider implements DeferrableProvider
|
||||
{
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->scoped('catevent', static function ($app) {
|
||||
return (new Dispatcher($app))->setQueueResolver(static function () use ($app) {
|
||||
return $app->make(QueueFactoryContract::class);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public function provides(): array
|
||||
{
|
||||
return ['catevent'];
|
||||
}
|
||||
}
|
||||
32
app/Providers/EventServiceProvider.php
Normal file
32
app/Providers/EventServiceProvider.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\TimeInterval;
|
||||
use App\Models\User;
|
||||
use App\Observers\TimeIntervalObserver;
|
||||
use App\Observers\UserObserver;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected $listen = [];
|
||||
|
||||
protected $subscribe = [];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
User::observe(UserObserver::class);
|
||||
TimeInterval::observe(TimeIntervalObserver::class);
|
||||
}
|
||||
|
||||
public function shouldDiscoverEvents(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
36
app/Providers/FilterServiceProvider.php
Normal file
36
app/Providers/FilterServiceProvider.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Helpers\FilterDispatcher;
|
||||
use Illuminate\Contracts\Queue\Factory as QueueFactoryContract;
|
||||
use Illuminate\Contracts\Support\DeferrableProvider;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Filter;
|
||||
use App\Filters\AttachmentFilter;
|
||||
|
||||
class FilterServiceProvider extends ServiceProvider implements DeferrableProvider
|
||||
{
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->scoped('filter', static function ($app) {
|
||||
return (new FilterDispatcher($app))->setQueueResolver(static function () use ($app) {
|
||||
return $app->make(QueueFactoryContract::class);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public function provides(): array
|
||||
{
|
||||
return ['filter'];
|
||||
}
|
||||
}
|
||||
28
app/Providers/RouteServiceProvider.php
Normal file
28
app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* This namespace is applied to your controller routes.
|
||||
*
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'App\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*/
|
||||
public function map(): void
|
||||
{
|
||||
Route::prefix('api')->middleware('api')->namespace($this->namespace)->group(base_path('routes/api.php'));
|
||||
Route::middleware('web')->namespace($this->namespace)->group(base_path('routes/web.php'));
|
||||
Route::prefix('actuator')->name('actuator.')->group(base_path('routes/actuator.php'));
|
||||
}
|
||||
}
|
||||
23
app/Providers/ScreenshotsServiceProvider.php
Normal file
23
app/Providers/ScreenshotsServiceProvider.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App;
|
||||
use Illuminate\Contracts\Support\DeferrableProvider;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ScreenshotsServiceProvider extends ServiceProvider implements DeferrableProvider
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->bind(
|
||||
App\Contracts\ScreenshotService::class,
|
||||
App\Services\ProductionScreenshotService::class
|
||||
);
|
||||
}
|
||||
|
||||
public function provides(): array
|
||||
{
|
||||
return [App\Contracts\ScreenshotService::class];
|
||||
}
|
||||
}
|
||||
28
app/Providers/SettingsServiceProvider.php
Normal file
28
app/Providers/SettingsServiceProvider.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Contracts\Support\DeferrableProvider;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use App\Services\SettingsProviderService;
|
||||
use App\Contracts\SettingsProvider;
|
||||
|
||||
class SettingsServiceProvider extends ServiceProvider implements DeferrableProvider
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->bind(
|
||||
SettingsProvider::class,
|
||||
SettingsProviderService::class
|
||||
);
|
||||
|
||||
$this->app->bind('settings', function () {
|
||||
return $this->app->makeWith(SettingsProvider::class, ['saveScope' => false]);
|
||||
});
|
||||
}
|
||||
|
||||
public function provides(): array
|
||||
{
|
||||
return [SettingsProvider::class, 'settings'];
|
||||
}
|
||||
}
|
||||
58
app/Providers/TelescopeServiceProvider.php
Normal file
58
app/Providers/TelescopeServiceProvider.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Laravel\Telescope\Console\PruneCommand;
|
||||
use Laravel\Telescope\IncomingEntry;
|
||||
use Laravel\Telescope\Telescope;
|
||||
use Laravel\Telescope\TelescopeApplicationServiceProvider;
|
||||
|
||||
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
Telescope::night();
|
||||
|
||||
$this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
|
||||
|
||||
$this->hideSensitiveRequestDetails();
|
||||
|
||||
Telescope::filter(function (IncomingEntry $entry) {
|
||||
if ($this->app->isLocal()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $entry->isReportableException() ||
|
||||
$entry->isFailedRequest() ||
|
||||
$entry->isFailedJob() ||
|
||||
$entry->isScheduledTask() ||
|
||||
$entry->hasMonitoredTag();
|
||||
});
|
||||
|
||||
$this->app->booted(function () {
|
||||
$this->app->make(Schedule::class)->command(PruneCommand::class)->daily();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent sensitive request details from being logged by Telescope.
|
||||
*/
|
||||
protected function hideSensitiveRequestDetails(): void
|
||||
{
|
||||
if ($this->app->isLocal()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Telescope::hideRequestParameters(['_token']);
|
||||
|
||||
Telescope::hideRequestHeaders([
|
||||
'cookie',
|
||||
'x-csrf-token',
|
||||
'x-xsrf-token',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user