codebar-ag/laravel-default-nova

codebar Solutions AG 为 Laravel Nova 项目提供的样板集成。

v2.0 2024-02-09 10:05 UTC

This package is auto-updated.

Last update: 2024-09-15 10:28:05 UTC


README

laravel-default-nova

Latest Version on Packagist run-tests PHPStan GitHub Code Style Action Status Total Downloads

安装

您可以通过 composer 安装此包

composer require codebar-ag/laravel-default-nova

NovaServiceProvider

<?php

namespace App\Providers;

use CodebarAg\LaravelDefaultNova\Providers\CustomNovaServiceProvider;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
use Laravel\Nova\Nova;

class NovaServiceProvider extends CustomNovaServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        parent::boot();
    }

    /**
     * Register the Nova routes.
     *
     * @return void
     */
    protected function routes()
    {
        Nova::routes();
    }

    /**
     * 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 Auth::check();
        });
    }

    /**
     * Get the dashboards that should be listed in the Nova sidebar.
     *
     * @return array
     */
    protected function dashboards()
    {
        return [
            new \App\Nova\Dashboards\Main,
        ];
    }

    /**
     * Get the tools that should be listed in the Nova sidebar.
     *
     * @return array
     */
    public function tools()
    {
        return [];
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        parent::register();
    }

}

配置

<?php

return [

    'prevent_lazy_loading' => app()->isLocal(),
    'with_breadcrumbs' => true,
    'without_notifications' => false,
    'resource_in' => 'Nova/Models',

    //'initial_path' => '/resources/users',
    //'assets' => ['js/nova.js', 'css/nova.css'],

    'policies' => [
        'namespace' => 'App\\Policies\\Nova\\',
    ],

];

测试

composer test

变更日志

请参阅 CHANGELOG 了解最近更改的详细信息。

贡献

请参阅 CONTRIBUTING 了解详细信息。

安全漏洞

请审查 我们的安全策略 了解如何报告安全漏洞。

致谢

许可证

MIT 许可证 (MIT)。请参阅 许可证文件 了解更多信息。