Skip to content

Instantly share code, notes, and snippets.

@beatwiz
Last active August 10, 2019 16:36
Show Gist options
  • Save beatwiz/428f24ed005e2bf517a2aa8cd535d54c to your computer and use it in GitHub Desktop.
Save beatwiz/428f24ed005e2bf517a2aa8cd535d54c to your computer and use it in GitHub Desktop.
Laravel + Nova Cheat Sheet

New Laravel Model (With Controller and Migration)

php artisan make:model Status -a

New Nova Card

php artisan nova:card provider/nova-clock

New Nova Value

php artisan nova:value NewCommits

New Nova Trend

php artisan nova:trend NewClientsTrend

New Nova Resource

php artisan nova:resource Client

Search Relations

https://github.com/TitasGailius/nova-search-relations

Advanced Media Library

https://github.com/ebess/advanced-nova-media-library

https://docs.spatie.be/laravel-medialibrary/v7/installation-setup/

https://docs.spatie.be/laravel-medialibrary/v7/basic-usage/preparing-your-model/

Dashboard Cards

Can be customized on NovaServiceProvider.php

protected function cards()
{
    return [
        // new Help(),
        (new NewClients())->width('1/2'),
        (new NewClientsTrend())->width('1/2'),
        (new NewCommits())->width('1/2'),
        (new NewCommitsTrend())->width('1/2'),
        // (new NovaClock())->currentUser(),
    ];
}

FlatPickr Locale

Copy /nova/resources/views/layout.blade.php to /resources/views/vendor/nova/ Add to the end of the file:

<!-- Change language default -->
<script src="https://npmcdn.com/flatpickr@4.5.2/dist/l10n/pt.js"></script>
<script>
    flatpickr.localize(flatpickr.l10ns.pt)
    flatpickr('.flatpickr-input')
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment