cloudstudio / card-extended
A Laravel Nova card.
Installs: 68 360
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 1
Forks: 1
Open Issues: 1
Requires
- php: >=7.1.0
This package is auto-updated.
Last update: 2024-12-29 05:51:09 UTC
README
Installation
You can install the package in to a Laravel app that uses Nova via composer:
composer require cloudstudio/card-extended
Next up, you must register the field with Nova. This is typically done in the resource file.
use Cloudstudio\CardExtended\CardExtended; /** * Get the cards available for the request. * * @param \Illuminate\Http\Request $request * @return array */ public function cards(Request $request) { return [ (new CardExtended()) ->view('cards.text') ->data(User::find(1)) ->onlyOnDetail() ->width('full'), ]; }
First parameter is a typical blade view
resurces/views/cards/text.blade.php
Example view
<div class="max-w-sm rounded overflow-hidden shadow-lg bg-white"> <img class="w-full" src="https://tailwindcss.com/img/card-top.jpg" alt="Sunset in the mountains"> <div class="px-6 py-4"> <div class="font-bold text-xl mb-2">{{ $data->name }}</div> <p class="text-grey-darker text-base"> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus quia, nulla! Maiores et perferendis eaque, exercitationem praesentium nihil. </p> </div> <div class="px-6 py-4"> <span class="inline-block bg-grey-lighter rounded-full px-3 py-1 text-sm font-semibold text-grey-darker mr-2">#photography</span> <span class="inline-block bg-grey-lighter rounded-full px-3 py-1 text-sm font-semibold text-grey-darker mr-2">#travel</span> <span class="inline-block bg-grey-lighter rounded-full px-3 py-1 text-sm font-semibold text-grey-darker">#winter</span> </div> </div>
Nova Card Preview
( Preview with this blade )
Second parameter is the data, you can use strings, number, array, collection...
$data = User::all(); $data = Auth::user()->name; $data = ['title' => 'Hello world'] $data = 'hello!'; $data = 1;
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.