anaseqal/nova-sidebar-icons
最新稳定版本:0.0.3
Composer 安装命令:
composer require anaseqal/nova-sidebar-icons
包简介
A Laravel Nova tool.
README 文档
README
Set icons for resources in sidebar.
Installation
You can install the package in to a Laravel app that uses Nova via composer:
composer require anaseqal/nova-sidebar-icons
Publish navigation view file:
php artisan vendor:publish --provider="Anaseqal\NovaSidebarIcons\ToolServiceProvider" --force
Register the tool in NovaServiceProvider:
use Anaseqal\NovaSidebarIcons\NovaSidebarIcons; ... public function tools() { return [ new NovaSidebarIcons, ... ]; }
Usage
Set the icon in your Nova resource, for example:
/** * The icon of the resource. * * @return string */ public static function icon() { // Assuming you have a blade file containing an image // in resources/views/vendor/nova/svg/icon-user.blade.php return view('nova::svg.icon-user')->render(); }
This is the recommended approach. In the example above we have used a blade file containing an svg, but if you'd want to it's is possible return the entire svg string
Examples of other approaches
// By using an image tag public static function icon() { return '<img src="/path/to/image.svg" />'; } // Or simply return it as a string public static function icon() { return '<svg class="sidebar-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <path fill="var(--sidebar-icon)" d="M4.06 13a8 8 0 0 0 5.18 .... e.t.c."/> </svg>'; }
Backwards compatibility
Please note that this package used to use a static $icon property on the resource. This has been replaced with the static icon method. The icon property is still supported to preserve backwards compatibility.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 203.69k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 49
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-04-27