Voyager下的Dashboard Widgets
widgets设置,voyager.php下找到'widgets':
'widgets' => [
'TCG\\Voyager\\Widgets\\UserDimmer',
'TCG\\Voyager\\Widgets\\PostDimmer',
],
效果如下:

根据命名空间查找:vendor/tcg/voyager/src/Widgets,下面我们进行自定义
在voyager.php添加 'App\Widgets\Products':
'widgets' => [
'TCG\\Voyager\\Widgets\\UserDimmer',
'TCG\\Voyager\\Widgets\\PostDimmer',
'App\\Widgets\\Products',
],
在app目录下创建Widgets文件夹,创建Products.php
<?php
namespace App\Widgets;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;
use TCG\Voyager\Facades\Voyager;
use Arrilot\Widgets\AbstractWidget;
class Products extends AbstractWidget
{
/**
* The configuration array.
*
* @var array
*/
protected $config = [];
/**
* Treat this method as a controller action.
* Return view() or other content to display.
*/
public function run()
{
$count = \App\Product::count();
$string = 'Products';
return view('voyager::dimmer', array_merge($this->config, [
'icon' => 'voyager-bag',
'title' => "{$count} {$string}",
'text' => __('voyager::dimmer.post_text', ['count' => $count, 'string' => Str::lower($string)]),
'button' => [
'text' => 'Products',
'link' => route('voyager.products.index'),
],
'image' => voyager_asset('images/widget-backgrounds/02.jpg'),
]));
}
/**
* Determine if the widget should be displayed.
*
* @return bool
*/
public function shouldBeDisplayed()
{
return Auth::user()->can('browse', Voyager::model('Post'));
}
}
最后一个是我们添加的:

修改背景图片:
上unsplush网站,找到一张合适的图片,然后修改image:
'image' =>'images/products-dimmer.jpg',
显示效果如下:

Voyager下的Dashboard Widgets的更多相关文章
- springboot1.4下hystrix dashboard Unable to connect to Command Metric Stream解决办法
搜索了好多资料,最后查看了官网.但是还是解决了.和大家分享下喜悦心情 在 此项目properties中添加如下信息 修改完信息后再浏览器输入:http://localhost:9875/hystrix ...
- 開始开发 Dashboard Widgets,第2章,读书笔记
文件夹:http://blog.csdn.net/wide288/article/details/40298693 主要内容: widgets 的组成是什么. 怎么创建 info.plist 文件 怎 ...
- Voyager下的Settings方法
设置网站标题,logo,描述: 自定义setting字段,添加group为文章,key为title的字段: 添加成功: 前端页面写法: <img src="{{ Voyager::im ...
- Voyager下的关系模型
关系:一个用户有几件商品,对应User表和Products表 在Products表下添加字段,user_id 打开products下的bread,点击Create Relationship Produ ...
- Voyager下的Media Manager文件管理与Menu Builder
Media Manager 默认存储位置在storage/app/public 上传文件,新建文件夹,移动,重命名,删除等等等功能 Menu Builder 创建新的Main菜单 创建一个shop菜单 ...
- Voyager的安装及配置文件
使用代理服务器安装laravel http_proxy=http://localhost:1080 composer create-project --prefer-dist laravel/lara ...
- Orchard官方文档翻译(十) 管理Widgets
原文地址:http://docs.orchardproject.net/Documentation/Managing-widgets 想要查看文档目录请用力点击这里 最近想要学习了解orchard,但 ...
- Dashboard二次开发简明教程
Horizon简介 Horizon是OpenStack的一个子项目,用于提供一个Web前端控制台(称为Dashboard),以此来展示OpenStack的功能.通常情况下,我们都是从Horizon.D ...
- kubernetes学习笔记之十一:kubernetes dashboard认证及分级授权
第一章.部署dashboard 作为Kubernetes的Web用户界面,用户可以通过Dashboard在Kubernetes集群中部署容器化的应用,对应用进行问题处理和管理,并对集群本身进行管理.通 ...
随机推荐
- ORA-01950:表空间“USERS”中无权限
ORA-01950:表空间“USERS”中无权限 解决方案: A)确认给用户授权了resource角色 B)取消限制 ALTER USER "HCCPMS" QUOTA UNLIM ...
- CC10:访问单个节点的删除
题目 实现一个算法,删除单向链表中间的某个结点,假定你只能访问该结点. 给定待删除的节点,请执行删除操作,若该节点为尾节点,返回false,否则返回true 解法 这道题并不难,主要是题目中这句话确定 ...
- HDU-1179-Ollivanders(二分图最大匹配)
链接:https://vjudge.net/problem/HDU-1179 题意: 有n个法师和m个魔棒,每个法师喜欢多种魔棒,但每个法师只能在喜欢的魔棒中选一个. 求最多有几个法师能选到魔棒. 思 ...
- CodeForces - 1004A-Sonya and Hotels(思维)
Sonya decided that having her own hotel business is the best way of earning money because she can pr ...
- hdu4403- A very hard Aoshu problem(搜索)
枚举等号的位置,然后暴力搜索一波 这个题本身不难,但它是我第一次使用对拍程序来查找错误,值得纪念. #include<cstdio> #include<string.h> #i ...
- Jmeter4.0----响应断言(6)
1.说明 一个HTTP请求发出去,怎么判断执行的任务是否成功呢?通过检查服务器响应数据,是否返回预期想要的数据,如果是,判断任务成功,反之任务失败. 作用:判断请求是否成功 2.步骤 第一步:添加 “ ...
- NET Core应用可以同时运行在Windows Container和Linux Container-1
NET Core多平台开发体验[1]: Windows 微软在千禧年推出 .NET战略,并在两年后推出第一个版本的.NET Framework和IDE(Visual Studio.NET 2002,后 ...
- @Slf4j注解的使用
项目中使用Slf4j日志: private static final Logger log=LoggerFactory.getLogger(TestMain.class); 使用@Slf4j以后,默认 ...
- bzoj 2301: [HAOI2011]Problem b mobius反演 RE
http://www.lydsy.com/JudgeOnline/problem.php?id=2301 设f(i)为在区间[1, n]和区间[1, m]中,gcd(x, y) = i的个数. 设F( ...
- HDU 1069 Monkey and Banana DP LIS变形题
http://acm.hdu.edu.cn/showproblem.php?pid=1069 意思就是给定n种箱子,每种箱子都有无限个,每种箱子都是有三个参数(x, y, z)来确定. 你可以选任意两 ...