jubeki / nova-card-linkable
A Linkeable Card for the Laravel Nova Dashboard.
Installs: 178 430
Dependents: 0
Suggesters: 0
Security: 0
Stars: 19
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: ^8.0
- laravel/nova: ^4.0
Requires (Dev)
- jubeki/laravel-code-style: ^1.0.0
- nunomaduro/larastan: ^2.1
- orchestra/testbench: ^7.1
- phpunit/phpunit: ^9.5
README
⚠️ These docs are for the latest version. If you are using an older version you can find the docs for previous releases here. To upgrade from
1.x
to2.x
please take a look at the Upgrade Guide
Add Cards to Laravel Nova which link to another page
Requirements
Installation
Just run:
composer require jubeki/nova-card-linkable
After this the setup will be complete and you can use the components listed here.
To publish the config you can simply run:
php artisan vendor:publish --provider="Jubeki\Nova\Cards\Linkable\CardServiceProvider"
Upgrading from 1.x to 2.x
To upgrade from 1.x
to 2.x
please take a look at the Upgrade Guide
Cards
What is the difference between the card types?
- Linkable: Links to a page in your application and makes use of inertia links
- Linkable Away: Links to a page which is outside of your application
The Design is the same for all of them and most of the options are also the same, so they will be listed here. (The left linkable card has a hover effect applied)
Usage
// in app/Nova/Dashboards/Main.php namespace App\Nova\Dashboards; use Jubeki\Nova\Cards\Linkable\Linkable; use Jubeki\Nova\Cards\Linkable\LinkableAway; use Laravel\Nova\Cards\Help; use Laravel\Nova\Dashboards\Main as Dashboard; class Main extends Dashboard { /** * Get the cards for the dashboard. * * @return array */ public function cards() { return [ (new Linkable) ->title('User Resource') ->url('/nova/resources/users') ->subtitle('Visit the index view of the User Resource'), (new LinkableAway) ->title('Nova Card Linkable') ->url('https://github.com/Jubeki/Nova-Card-Linkable/') ->subtitle('Visit the GitHub Repository'), new Help, ]; } }
Options
All options are chainable.
Setting the subtitle of the Card
$linkable->title('Title of Card');
Setting the subtitle of the Card
$linkable->subtitle('Subtitle of Card');
Setting the url of the Card
$linkable->url('https://github.com/Jubeki/Nova-Card-Linkable');
Setting the theme of the Card
$linkable->theme([ 'layout' => 'p-3 flex flex-col items-center justify-center h-full', 'colors' => 'text-90 hover:text-primary-600', 'title' => 'text-3xl font-light text-center', 'subtitle' => 'text-lg font-light text-center', ]);
Setting the target
only available for Jubeki\Nova\Cards\Linkable\LinkableAway
$linkable->target('_blank');