File: /home/eslinced-103/brise-edu.or.kr/app/Providers/NovaServiceProvider.php
<?php
namespace App\Providers;
use AmuzPackages\EslincEdu\Dashboards\Main;
use AmuzPackages\EslincEdu\Dashboards\Report;
use App\Amuz\NovaTools\AmuzTool;
use App\Models\Central\Tenant;
use App\Models\User;
use App\Nova\Central\SubscriptionCancelation;
use Bolechen\NovaActivitylog\NovaActivitylog;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Gate;
use Laravel\Nova\Nova;
use Laravel\Nova\NovaApplicationServiceProvider;
use Vyuldashev\NovaPermission\NovaPermissionTool;
class NovaServiceProvider extends NovaApplicationServiceProvider
{
/**
* Bootstrap any application services.
*/
public function boot(): void
{
parent::boot();
Nova::style('noto-sans-kr', public_path('assets/notosans_kr.css'));
Nova::style('custom-admin', public_path('assets/amuz_cms2.css'));
// Nova::theme('link/to/your/file.css');
Nova::serving(function () {
Tenant::creating(function (Tenant $tenant) {
$tenant->ready = false;
});
Tenant::created(function (Tenant $tenant) {
$tenant->createAsStripeCustomer();
});
});
Nova::footer(function ($request) {
return Blade::render('
<p class="mt-8 text-center text-xs text-80">
<a href="https://cms.amuz.co.kr" class="text-primary dim no-underline" target="_blank">AMUZ CMS2</a>
<span class="px-1">·</span>
© {{ date("Y") }} AmuzCORP - By <a href="mailto:ceo@amuz.co.kr" target="_blank">XISO</a>.
<span class="px-1">·</span>
v{{ \Laravel\Nova\Nova::version() }}
</p>');
});
}
/**
* Register the Nova routes.
*/
protected function routes(): void
{
Nova::routes()
->withAuthenticationRoutes(['tenant', 'universal', 'nova'])
->withPasswordResetRoutes(['tenant', 'universal', 'nova'])
->register();
}
/**
* Register the Nova gate.
*
* This gate determines who can access Nova in non-local environments.
*/
protected function gate(): void
{
Gate::define('viewNova', function ($user) {
if ($user instanceof User) {
// In the tenant app, only the owner of the tenant can view Nova
return $user->isOwner();
} elseif ($user instanceof \App\Models\Central\Admin) {
// In the central app, the only logged in users are admins
return true;
}
return false;
});
}
/**
* Get the dashboards that should be listed in the Nova sidebar.
*/
protected function dashboards(): array
{
return [
new Main,
new Report,
];
}
/**
* Get the tools that should be listed in the Nova sidebar.
*/
public function tools(): array
{
return [
new AmuzTool(),
new \Llaski\NovaScheduledJobs\Tool(),
NovaPermissionTool::make(),
new NovaActivitylog(),
new \Outl1ne\NovaSettings\NovaSettings,
];
}
protected function resources(): void
{
Nova::resources([
SubscriptionCancelation::class,
]);
}
/**
* Register any application services.
*/
public function register(): void
{
//
}
}