first commit
Some checks failed
Build / run (push) Has been cancelled

This commit is contained in:
maher
2025-10-29 11:42:25 +01:00
commit 703f50a09d
4595 changed files with 385164 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
<?php
namespace App\Providers;
use App\Actions\AppValueLists;
use App\Models\Channel;
use App\Models\Episode;
use App\Models\NewsArticle;
use App\Models\Person;
use App\Models\Season;
use App\Models\Title;
use App\Services\Admin\GetAnalyticsHeaderData;
use App\Services\AppBootstrapData;
use App\Services\UrlGenerator;
use Common\Admin\Analytics\Actions\GetAnalyticsHeaderDataAction;
use Common\Core\Bootstrap\BootstrapData;
use Common\Core\Contracts\AppUrlGenerator;
use Common\Core\Values\ValueLists;
use Common\Search\ImportRecordsIntoScout;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function boot(): void
{
$this->app->bind(BootstrapData::class, AppBootstrapData::class);
Relation::enforceMorphMap([
Title::MODEL_TYPE => Title::class,
'movie' => Title::class,
'series' => Title::class,
Season::MODEL_TYPE => Season::class,
Episode::MODEL_TYPE => Episode::class,
Person::MODEL_TYPE => Person::class,
NewsArticle::MODEL_TYPE => NewsArticle::class,
]);
Model::preventLazyLoading(!$this->app->isProduction());
// This will only work when loading from collection, because we need access to channel config
Channel::resolveRelationUsing(
'items',
fn(Channel $channel) => $channel->morphedByMany(
modelTypeToNamespace(
$channel->config['contentModel'] ?? Title::class,
),
'channelable',
),
);
if (config('common.site.disable_scout_auto_sync')) {
foreach (ImportRecordsIntoScout::getSearchableModels() as $model) {
$model::disableSearchSyncing();
}
}
}
public function register(): void
{
// bind analytics
$this->app->bind(
GetAnalyticsHeaderDataAction::class,
GetAnalyticsHeaderData::class,
);
$this->app->bind(AppUrlGenerator::class, UrlGenerator::class);
$this->app->bind(ValueLists::class, AppValueLists::class);
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes(['prefix' => 'secure', 'middleware' => 'web']);
require base_path('routes/channels.php');
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Providers;
use App\Listeners\CreateWatchlist;
use App\Listeners\DeleteUserChannels;
use Common\Auth\Events\UserCreated;
use Common\Auth\Events\UsersDeleted;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
UserCreated::class => [
CreateWatchlist::class,
],
UsersDeleted::class => [
DeleteUserChannels::class
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
parent::boot();
//
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Providers;
use App\Models\User;
use Illuminate\Support\Facades\Gate;
use Laravel\Horizon\HorizonApplicationServiceProvider;
class HorizonServiceProvider extends HorizonApplicationServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
parent::boot();
// Horizon::routeSmsNotificationsTo('15556667777');
// Horizon::routeMailNotificationsTo('example@example.com');
// Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
// Horizon::night();
}
/**
* Register the Horizon gate.
*
* This gate determines who can access Horizon in non-local environments.
*
* @return void
*/
protected function gate()
{
Gate::define('viewHorizon', function (User $user) {
if (config('common.site.demo')) {
return $user->email === 'Ic0OdCIodqz8q1r@demo.com';
} else {
return $user->hasPermission('admin');
}
});
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace App\Providers;
use App\Models\User;
use Auth;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\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';
/**
* The path to the "home" route for your application.
*
* @var string
*/
public const HOME = '/';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
Route::bind('user', function ($value) {
$id = $value === 'me' ? Auth::id() : (int) $value;
return User::findOrFail($id);
});
parent::boot();
}
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
//
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
}
}