Skip to content

codebar-ag/laravel-default-nova

Repository files navigation

laravel-default-nova

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

Installation

You can install the package via 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();
    }

}

Config

<?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\\',
    ],

];

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.