wip fix
This commit is contained in:
1 parent
9bcd4432c6
commit
6f92f9e1d5
1209 files changed
+220940
No files matched your search
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Filament\Resources\Events\Pages\ListEvents;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Support\Assets\Css;
|
||||
use Filament\Support\Assets\Js;
|
||||
use Filament\Support\Colors\Color;
|
||||
use Filament\Support\Facades\FilamentAsset;
|
||||
use Filament\Support\Facades\FilamentColor;
|
||||
use Filament\Support\Facades\FilamentTimezone;
|
||||
use Filament\Support\Facades\FilamentView;
|
||||
use Filament\Tables\View\TablesRenderHook;
|
||||
use Filament\View\PanelsRenderHook;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
|
||||
FilamentTimezone::set('Europe/Vienna');
|
||||
|
||||
/** Alpine Plugin direct */
|
||||
FilamentView::registerRenderHook(
|
||||
'panels::head.end',
|
||||
fn(): HtmlString => new HtmlString('
|
||||
<script>
|
||||
document.addEventListener("alpine:init", () => {
|
||||
(function(){function l(t){t.directive("sort",(e,{modifiers:d,expression:c},{evaluateLater:p,cleanup:f})=>{let m=p(c),v=d.includes("group")?e.getAttribute("x-sort:group"):"default";e._sortable=new Sortable(e,{group:v,animation:150,onEnd:s=>{let n=s.item.getAttribute("x-sort:item"),a=s.oldIndex,i=s.newIndex,r=s.to.getAttribute("id")||"default";m(()=>{},{scope:{$item:n,$oldIndex:a,$newIndex:i,$owner:r}})}});f(()=>e._sortable.destroy())})}l.inline=l;var u=l;document.addEventListener("DOMContentLoaded",()=>{if(typeof Sortable==="undefined"){let t=document.createElement("script");t.src="https://cloudflare.com";document.head.appendChild(t)}});})();
|
||||
});
|
||||
</script>
|
||||
'),
|
||||
);
|
||||
|
||||
FilamentAsset::register([
|
||||
Css::make('font-stylesheet', __DIR__ . '/../../resources/css/font.css'),
|
||||
Js::make('number-animator', __DIR__ . '/../../resources/js/number-animator.js'),
|
||||
]);
|
||||
|
||||
FilamentView::registerRenderHook(
|
||||
PanelsRenderHook::USER_MENU_PROFILE_AFTER,
|
||||
fn(): string => Blade::render('@livewire(\'konto-switcher\')'),
|
||||
);
|
||||
FilamentView::registerRenderHook(
|
||||
TablesRenderHook::TOOLBAR_SEARCH_BEFORE,
|
||||
fn(): string => Blade::render('@livewire(\'sport-switcher\')'),
|
||||
scopes: [
|
||||
ListEvents::class,
|
||||
]
|
||||
);
|
||||
// PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_BEFORE,
|
||||
FilamentView::registerRenderHook(
|
||||
TablesRenderHook::TOOLBAR_SEARCH_AFTER,
|
||||
fn(): string => Blade::render('@livewire(\'bettype-toggle\')'),
|
||||
scopes: [
|
||||
ListEvents::class,
|
||||
]
|
||||
);
|
||||
FilamentView::registerRenderHook(
|
||||
PanelsRenderHook::GLOBAL_SEARCH_BEFORE,
|
||||
fn(): string => Blade::render('@livewire(\'top-menu-items\')')
|
||||
);
|
||||
|
||||
// FilamentView::registerRenderHook(
|
||||
// PanelsRenderHook::GLOBAL_SEARCH_AFTER,
|
||||
// fn (): View => view('filament.modals.position-abbreviation'),
|
||||
// );
|
||||
|
||||
Carbon::setLocale(app()->getLocale());
|
||||
|
||||
FilamentColor::register([
|
||||
'primary' => Color::Blue,
|
||||
'danger' => Color::Red,
|
||||
'gray' => Color::Zinc,
|
||||
'info' => Color::Blue,
|
||||
'success' => Color::Green,
|
||||
'warning' => Color::Amber,
|
||||
'sky' => Color::Sky,
|
||||
'yellow' => Color::Yellow,
|
||||
'teal' => Color::Teal,
|
||||
'purple' => Color::Purple,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use App\Filament\Exports\BetfairExporter;
|
||||
use App\Filament\Pages\PlayerProps;
|
||||
use App\Filament\Pages\Statistic;
|
||||
use App\Http\Middleware\RecordUserActivity;
|
||||
use Awcodes\LightSwitch\Enums\Alignment;
|
||||
use Awcodes\LightSwitch\LightSwitchPlugin;
|
||||
use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ExportAction;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
use Filament\Auth\MultiFactor\App\AppAuthentication;
|
||||
use Filament\Auth\MultiFactor\Email\EmailAuthentication;
|
||||
use Filament\Auth\Pages\PasswordReset\RequestPasswordReset;
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\AuthenticateSession;
|
||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
||||
use Filament\Panel;
|
||||
use Filament\PanelProvider;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||
use Illuminate\Session\Middleware\StartSession;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||
use Joaopaulolndev\FilamentEditProfile\FilamentEditProfilePlugin;
|
||||
use Joaopaulolndev\FilamentEditProfile\Pages\EditProfilePage;
|
||||
use Swis\Filament\Backgrounds\FilamentBackgroundsPlugin;
|
||||
use Swis\Filament\Backgrounds\ImageProviders\MyImages;
|
||||
|
||||
class AdminPanelProvider extends PanelProvider
|
||||
{
|
||||
public function panel(Panel $panel): Panel
|
||||
{
|
||||
return $panel
|
||||
->spa()
|
||||
->id('admin')
|
||||
->breadcrumbs(false)
|
||||
->middleware([
|
||||
RecordUserActivity::class,
|
||||
])
|
||||
->userMenuItems([
|
||||
ExportAction::make('download_betfair')
|
||||
->columnMapping(false)
|
||||
->exporter(BetfairExporter::class)
|
||||
->label('Download Betfair')
|
||||
->visible(fn (): bool => Auth::user()->hasRole('download_betfair'))
|
||||
->fileName(fn (Export $export): string => 'betfair-odds-'.date('d.m.Y-H.i')."-{$export->getKey()}")
|
||||
->modifyQueryUsing(fn (Builder $query) => $query->whereHas('odds_3ways_bf')
|
||||
->whereHas('odds_totals_bf')
|
||||
->where('sport_id', 1))
|
||||
->icon('phosphor-download'),
|
||||
])
|
||||
->path('')
|
||||
->login()
|
||||
->passwordReset(RequestPasswordReset::class)
|
||||
->emailVerification()
|
||||
->emailChangeVerification()
|
||||
->databaseNotifications()
|
||||
->databaseNotificationsPolling('10s') // default is 30
|
||||
->profile(isSimple: false)
|
||||
->default()
|
||||
->globalSearch(false)
|
||||
->globalSearchKeyBindings(['command+k', 'ctrl+k'])
|
||||
->brandLogo(asset('logo/statistiko.svg'))
|
||||
->darkModeBrandLogo(asset('logo/statistiko-d.svg'))
|
||||
->favicon(asset('favicon/favicon.ico'))
|
||||
->brandName('')
|
||||
->brandLogoHeight('2rem')
|
||||
->unsavedChangesAlerts()
|
||||
->topNavigation()
|
||||
->multiFactorAuthentication([
|
||||
EmailAuthentication::make(),
|
||||
AppAuthentication::make()
|
||||
->recoverable(),
|
||||
])
|
||||
// ], isRequired: true)
|
||||
->viteTheme('resources/css/filament/admin/theme.css')
|
||||
->discoverResources(in: app_path('Filament/Resources'), for: 'App\Filament\Resources')
|
||||
->discoverPages(in: app_path('Filament/Pages'), for: 'App\Filament\Pages')
|
||||
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\Filament\Widgets')
|
||||
->discoverClusters(in: app_path('Filament/Clusters'), for: 'App\\Filament\\Clusters')
|
||||
->maxContentWidth(Width::ScreenTwoExtraLarge)
|
||||
->breadcrumbs(false)
|
||||
->sidebarCollapsibleOnDesktop(false)
|
||||
->userMenuItems([
|
||||
'profile' => Action::make('profile')
|
||||
->label(fn () => Auth::user()->name)
|
||||
->url(fn (): string => EditProfilePage::getUrl())
|
||||
->icon('phosphor-user-circle-fill'),
|
||||
])
|
||||
->pages([
|
||||
Statistic::class,
|
||||
PlayerProps::class,
|
||||
])
|
||||
->widgets([])
|
||||
->middleware([
|
||||
EncryptCookies::class,
|
||||
AddQueuedCookiesToResponse::class,
|
||||
StartSession::class,
|
||||
AuthenticateSession::class,
|
||||
ShareErrorsFromSession::class,
|
||||
VerifyCsrfToken::class,
|
||||
SubstituteBindings::class,
|
||||
DisableBladeIconComponents::class,
|
||||
DispatchServingFilamentEvent::class,
|
||||
])
|
||||
->authMiddleware([
|
||||
Authenticate::class,
|
||||
])->plugins([
|
||||
FilamentShieldPlugin::make()
|
||||
->navigationGroup('User')
|
||||
->navigationSort(10)
|
||||
->navigationBadge(5),
|
||||
// HooksHelperPlugin::make(),
|
||||
FilamentEditProfilePlugin::make()->shouldRegisterNavigation(false),
|
||||
LightSwitchPlugin::make()->position(Alignment::BottomCenter),
|
||||
FilamentBackgroundsPlugin::make()
|
||||
->imageProvider(MyImages::make()->directory('images/backgrounds')),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
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->hideSensitiveRequestDetails();
|
||||
|
||||
$isLocal = $this->app->environment('local');
|
||||
|
||||
Telescope::filter(function (IncomingEntry $entry) use ($isLocal) {
|
||||
return $isLocal ||
|
||||
$entry->isReportableException() ||
|
||||
$entry->isFailedRequest() ||
|
||||
$entry->isFailedJob() ||
|
||||
$entry->isScheduledTask() ||
|
||||
$entry->hasMonitoredTag();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent sensitive request details from being logged by Telescope.
|
||||
*/
|
||||
protected function hideSensitiveRequestDetails(): void
|
||||
{
|
||||
if ($this->app->environment('local')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Telescope::hideRequestParameters(['_token']);
|
||||
|
||||
Telescope::hideRequestHeaders([
|
||||
'cookie',
|
||||
'x-csrf-token',
|
||||
'x-xsrf-token',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Telescope gate.
|
||||
*
|
||||
* This gate determines who can access Telescope in non-local environments.
|
||||
*/
|
||||
protected function gate(): void
|
||||
{
|
||||
Gate::define('viewTelescope', function (User $user) {
|
||||
return in_array($user->email, [
|
||||
//
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user