Initial commit

This commit is contained in:
Developer
2025-04-21 16:03:20 +02:00
commit 2832896157
22874 changed files with 3092801 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Auth\Notifications\VerifyEmail;
use Illuminate\Notifications\Messages\MailMessage;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
}
public function boot()
{
VerifyEmail::toMailUsing(function ($notifiable, $url) {
return (new MailMessage)
->subject('Подтвердите адрес электронной почты')
->greeting('Здравствуйте!')
->line('Пройдите по ссылке для подтверждения вашего email.')
->action('Подтвердить email', $url)
->line('Если вы не создавали аккаунт, никаких действий не требуется');
});
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
'App\Models\User' => 'App\Policies\UserPolicy',
];
/**
* 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();
require base_path('routes/channels.php');
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Providers;
use App\Domain\Feeds\Models\Feed;
use App\Domain\Texts\Models\Text;
use App\Domain\Images\Models\Image;
use App\Domain\Musics\Models\Music;
use App\Domain\Videos\Models\Video;
use Illuminate\Support\ServiceProvider;
use App\Domain\Payments\Models\BankRequisites;
use Illuminate\Database\Eloquent\Relations\Relation;
class EloquentServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
Relation::morphMap([
'texts' => Text::class,
'images' => Image::class,
'videos' => Video::class,
'musics' => Music::class,
'feeds' => Feed::class,
'payoutsBank' => BankRequisites::class,
]);
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
//
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace App\Providers;
use App\Events\FeedAddProcessed;
use App\Events\FeedRemoveProcessed;
use App\Events\FeedUpdateProcessed;
use App\Listeners\RemoveFeedUsers;
use App\Listeners\AddFeedUsers;
use App\Listeners\UpdateFeedUsers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
FeedAddProcessed::class => [
AddFeedUsers::class,
],
FeedRemoveProcessed::class => [
RemoveFeedUsers::class,
],
// FeedUpdateProcessed::class => [
// UpdateFeedUsers::class,
// ],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
//
}
}

View File

@@ -0,0 +1,136 @@
<?php
namespace App\Providers;
use Laravel\Nova\Nova;
use App\Policies\RolePolicy;
use Laravel\Nova\Cards\Help;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Fields\Number;
use Laravel\Nova\Fields\Boolean;
use App\Domain\Feeds\Models\Feed;
use App\Domain\Votes\Models\Vote;
use App\Policies\PermissionPolicy;
use Illuminate\Support\Facades\Gate;
use App\Domain\Comments\Models\Comment;
use App\Domain\Payments\Models\Withdrawal;
use App\Domain\Complaints\Models\Complaint;
use App\Domain\Votes\Observers\VoteObserver;
use App\Domain\Feeds\Observers\NovaFeedObserver;
use Laravel\Nova\NovaApplicationServiceProvider;
use App\Domain\Payments\Observers\WithdrawalObserver;
use App\Domain\Comments\Observers\NovaCommentObserver;
use App\Domain\Complaints\Observers\ComplaintObserver;
use App\Domain\Feeds\Observers\NovaFeedAdsObserver;
class NovaServiceProvider extends NovaApplicationServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
parent::boot();
Nova::serving(function () {
Complaint::observe(ComplaintObserver::class);
Vote::observe(VoteObserver::class);
Withdrawal::observe(WithdrawalObserver::class);
Feed::observe(NovaFeedObserver::class);
Feed::observe(NovaFeedAdsObserver::class);
Comment::observe(NovaCommentObserver::class);
});
\OptimistDigital\NovaSettings\NovaSettings::addSettingsFields([
Number::make('Количество лидеров', 'vote_leader_count'),
Number::make('Процент сайта', 'vote_procent_site'),
Number::make('Процент лидера', 'vote_procent_leader'),
Number::make('Процент локального лидера', 'vote_procent_local_leader'),
Boolean::make('Платный режим включен', 'vote_paid_mode')
]);
}
/**
* Register the Nova routes.
*
* @return void
*/
protected function routes()
{
Nova::routes()
->withAuthenticationRoutes()
->withPasswordResetRoutes()
->register();
}
/**
* Register the Nova gate.
*
* This gate determines who can access Nova in non-local environments.
*
* @return void
*/
protected function gate()
{
Gate::define('viewNova', function ($user) {
return $user->hasDirectPermission('access');
// return in_array($user->email, [
// ]);
});
}
/**
* Get the cards that should be displayed on the default Nova dashboard.
*
* @return array
*/
protected function cards()
{
return [
//new Help,
];
}
/**
* Get the extra dashboards that should be displayed on the Nova dashboard.
*
* @return array
*/
protected function dashboards()
{
return [];
}
/**
* Get the tools that should be listed in the Nova sidebar.
*
* @return array
*/
public function tools()
{
return [
\Vyuldashev\NovaPermission\NovaPermissionTool::make()
->rolePolicy(RolePolicy::class)
->permissionPolicy(PermissionPolicy::class),
new \OptimistDigital\NovaSettings\NovaSettings,
];
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
*
* This is used by Laravel authentication to redirect users after login.
*
* @var string
*/
public const HOME = '/';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::middleware('web')
->group(base_path('routes/web.php'));
Route::prefix('api')
->middleware('api')
->group(base_path('routes/api.php'));
});
}
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60);
});
}
}