nova-laravel-com-docs-v5-installation
nova-laravel-com-docs-v5-installation
Actions
"repositories": [
Defining Actions {
"type": "composer",
Registering Actions
"url": "https://nova.laravel.com"
}
Metrics ],
Defining Metrics
Registering Metrics Or, you may use the following CLI command to add the Composer repository to your
composer.json file:
Digging Deeper
Menus
Notifications Next, you may add laravel/nova to your list of required packages in your
composer.json file:
Authentication
Impersonation
composer.json
Tools
"require": {
"php": "^8.2",
"laravel/framework": "^12.0",
"laravel/nova": "^5.0"
},
Community
Blog
After your composer.json file has been updated, run the composer update
command in your console terminal:
Get Started
Repeater Fields
Field Panels Finally, run the nova:install and migrate Artisan commands. The nova:install
Relationships command will install Nova’s service provider and public assets within your application:
Validation
php artisan nova:install
Authorization
php artisan migrate
Search
The Basics
The default App\Nova\User Nova resource references the App\Models\User model.
Global Search If you place your models in a different directory or namespace, you should adjust this
Scout Integration value within the resource:
app/Nova/User.php
Filters
Registering Metrics
That’s it! Next, you may navigate to your application’s /nova path in your browser and
Digging Deeper you should be greeted with the Nova dashboard which includes links to various parts of
Dashboards this documentation.
Menus
Notifications Registering a Nova License Key and Production URL
Authentication
Nova requires a license key and a production URL to be used in production
Impersonation environments. Nova will check your license key and the current host against the values
Tools from the license details found in your Nova account.
You can generate license keys and register the production URL for your project inside
the license’s page on your Nova account at https://nova.laravel.com/licenses:
Community
Blog
Get Started
Installation
Release Notes
Upgrade Guide
Resources
The Basics
Fields
Dependent Fields
Date Fields
File Fields
Repeater Fields
You can register a wildcard subdomain for your production URL for use in multi-tenant
Field Panels scenarios (e.g. *.laravel.com ).
Relationships
Validation You can register your license key by setting the NOVA_LICENSE_KEY variable to .env
file or license_key option in your config/nova.php configuration file:
Authorization
.env config/nova.php
Search
Global Search
Scout Integration
Verifying Your Nova License Key Configuration
Filters To verify everything has been configured correctly, you should run the nova:check-
license command:
Defining Filters
Registering Filters
php artisan nova:check-license
Lenses
Defining Lenses
Authenticating Nova in CI Environments
Registering Lenses
It’s not recommended to store your Composer auth.json file inside your project’s
source control repository. However, there may be times you wish to download Nova
Actions
inside a CI environment like CodeShip. For instance, you may wish to run tests for any
Defining Actions custom tools you create.
Registering Actions
To authenticate Nova in these situations, you can use Composer’s config command
to set the configuration option inside your CI system’s pipeline, injecting environment
Metrics variables containing your Nova username and license key:
Defining Metrics
Registering Metrics composer config http-basic.nova.laravel.com "${NOVA_USERNAME}" "${NOVA_LI
Digging Deeper
Tools .example
.invalid
.localhost
.local
Nova will also not check the current license key when the subdomain is one of these
Community commonly-used staging subdomains:
Blog
staging.
test.
Installation
testing.
Release Notes
dev.
Upgrade Guide
development.
Resources
Relationships
use Illuminate\Support\Facades\Gate;
Validation
Authorization // ...
/**
Search * Register the Nova gate.
*
The Basics
* This gate determines who can access Nova in non-local environments.
Global Search */
protected function gate(): void
Scout Integration
{
Gate::define('viewNova', function ($user) {
Filters return in_array($user->email, [
'taylor@laravel.com',
Defining Filters ]);
Registering Filters });
}
Lenses
Defining Lenses
Customization
Registering Lenses
Branding
Actions Although Nova’s interface is intended to be an isolated part of your application that is
Defining Actions
managed by Nova, you can make some small customizations to the branding logo and
color used by Nova to make the interface more cohesive with the rest of your
Registering Actions application.
Metrics
Defining Metrics
Registering Metrics
Digging Deeper
Dashboards
Menus
Notifications
Authentication
Impersonation
Tools
Brand Logo
To customize the logo used at the top left of the Nova interface, you may specify a
configuration value for the brand.logo configuration item within your application’s
config/nova.php configuration file. This configuration value should contain an
absolute path to the SVG file of the logo you would like to use:
Community config/nova.php
Blog
'brand' => [
'logo' => resource_path('/img/example-logo.svg'),
Get Started
// ...
Installation
],
Release Notes
Upgrade Guide
You may need to adjust the size and width of your SVG logo by modifying its width in the
SVG file itself.
Resources
The Basics
Fields Brand Color
Dependent Fields To customize the color used as the “primary” color within the Nova interface, you may
specify a value for the brand.colors configuration item within your application’s
Date Fields
config/nova.php configuration file. This color will be used as the primary button color
File Fields as well as the color of various emphasized items throughout the Nova interface. This
Repeater Fields configuration value should be a valid RGB, RGBA, or HSL string value:
Field Panels
config/nova.php
Relationships
Validation 'brand' => [
// ...
Authorization
'colors' => [
Search "400" => "24, 182, 155, 0.5",
"500" => "24, 182, 155",
The Basics "600" => "24, 182, 155, 0.75",
]
Global Search
],
Scout Integration
Filters
Customizing Nova’s Footer
Defining Filters
There are times you may wish to customize Nova’s default footer text to include
Registering Filters relevant information for your users, such as your application version, IP addresses, or
other information. Using the Nova::footer method, you may customize the footer
Lenses text of your Nova installation. Typically, the footer method should be called within
the boot method of your application’s App\Providers\NovaServiceProvider class:
Defining Lenses
Registering Lenses app/Providers/NovaServiceProvider.php
Metrics /**
* Boot any application services.
Defining Metrics
*/
Registering Metrics public function boot(): void
{
parent::boot();
Digging Deeper
Community
.env config/nova.php
Blog
NOVA_GUARD=(null)
Get Started
Installation
Release Notes
Customizing Nova’s Storage Disk Driver
Upgrade Guide Nova uses the default storage disk driver defined in your filesystems configuration
file. If you would like to customize this disk, you may set the NOVA_STORAGE_DISK value
using .env file the storage_disk value within Nova’s configuration file:
Resources
Fields
NOVA_STORAGE_DISK=public
Dependent Fields
Date Fields
File Fields Customizing Nova’s Initial Path
Repeater Fields
When visiting Nova, the Main dashboard is typically loaded by default. However, you
Field Panels are free to define a different initial path that should be loaded using Nova’s
Relationships initialPath method. Typically, this method may be invoked from the register
method of your application’s App\Providers\NovaServiceProvider service provider:
Validation
Authorization app/Providers/NovaServiceProvider.php
Search /**
* Register any application services.
The Basics */
Global Search public function register(): void
{
Scout Integration parent::register();
Filters Nova::initialPath('/resources/users');
Lenses In addition to a string path, the initialPath method also accepts a closure that
Defining Lenses returns the path that should be loaded. This allows you to dynamically determine the
initial path based on the incoming request:
Registering Lenses
app/Providers/NovaServiceProvider.php
Actions
app/Providers/NovaServiceProvider.php
Community /**
* Boot any application services.
Blog */
public function boot(): void
Get Started {
parent::boot();
Installation
Release Notes Nova::withBreadcrumbs();
}
Upgrade Guide
Resources The withBreadcrumbs method also accepts a closure that allows you to enable
breadcrumbs for specific users or other custom scenarios:
The Basics
Fields app/Providers/NovaServiceProvider.php
Dependent Fields
use Laravel\Nova\Http\Requests\NovaRequest;
Date Fields
use Laravel\Nova\Nova;
File Fields
// ...
Repeater Fields
Field Panels Nova::withBreadcrumbs(function (NovaRequest $request) {
return $request->user()->wantsBreadcrumbs();
Relationships
});
Validation
Authorization
Enabling RTL Support
Search
If you wish to display Nova’s content “right-to-left” (RTL), you can enable this behavior
The Basics by calling the enableRTL method from your App\Providers\NovaServiceProvider
Global Search service provider:
Scout Integration
app/Providers/NovaServiceProvider.php
Filters /**
* Boot any application services.
Defining Filters
*/
Registering Filters public function boot(): void
{
parent::boot();
Lenses
Actions The enableRTL method also accept a closure that allows you to enable RTL support
for specific users or in other custom scenarios:
Defining Actions
Registering Actions
use Illuminate\Http\Request;
use Laravel\Nova\Nova;
Metrics
// ...
Defining Metrics
Registering Metrics Nova::enableRTL(fn (Request $request) => $request->user()->wantsRTL());
Digging Deeper
Tools
/**
* Boot any application services.
*/
public function boot(): void
{
Community parent::boot();
Blog Nova::withoutThemeSwitcher();
}
Get Started
Installation
Release Notes Error Reporting
Upgrade Guide Nova uses its own internal exception handler instead of using the default
App\Exceptions\ExceptionHandler . If you need to integrate third-party error
Resources reporting tools with your Nova installation, you should use the Nova::report method.
Typically, this method should be invoked from the register method of your
The Basics
application’s App\Providers\NovaServiceProvider class:
Fields
Dependent Fields app/Providers/NovaServiceProvider.php
Date Fields
/**
File Fields * Register any application services.
*/
Repeater Fields
public function register(): void
Field Panels {
parent::register();
Relationships
Validation Nova::report(function ($exception) {
if (app()->bound('sentry')) {
Authorization
app('sentry')->captureException($exception);
}
Search });
}
The Basics
Global Search
Scout Integration
Updating Nova
Filters To update your Nova installation, you may run the composer update command:
Defining Filters
composer update
Registering Filters
Lenses
Updating Nova’s Assets
Defining Lenses
After updating to a new Nova release, you should be sure to update Nova’s JavaScript
Registering Lenses and CSS assets using the nova:publish Artisan command and clear any cached
views using the view:clear Artisan command. This will ensure the newly-updated
Actions Nova version is using the latest versions of Nova’s assets and views:
Defining Actions
php artisan nova:publish
Registering Actions
php artisan view:clear
Metrics
Defining Metrics The nova:publish command will re-publish Nova’s public assets, configuration, views,
and language files. This command will not overwrite any existing configuration, views, or
Registering Metrics
language files. If you would like the command to overwrite existing files, you may use
the --force flag when executing the command:
Digging Deeper
"scripts": {
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
Community "@php artisan nova:publish --ansi"
]
Blog }
Get Started
The Basics
Global Search
Scout Integration
Lenses
Defining Lenses
Registering Lenses
Actions
Defining Actions
Registering Actions
Metrics
Defining Metrics
Registering Metrics
Digging Deeper
Dashboards
Menus
Notifications
Authentication
Impersonation
Tools