cloudstudio/card-extended
Composer 安装命令:
composer require cloudstudio/card-extended
包简介
A Laravel Nova card.
README 文档
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.
统计信息
- 总下载量: 77.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-04-30
