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的更多相关文章

  1. springboot1.4下hystrix dashboard Unable to connect to Command Metric Stream解决办法

    搜索了好多资料,最后查看了官网.但是还是解决了.和大家分享下喜悦心情 在 此项目properties中添加如下信息 修改完信息后再浏览器输入:http://localhost:9875/hystrix ...

  2. 開始开发 Dashboard Widgets,第2章,读书笔记

    文件夹:http://blog.csdn.net/wide288/article/details/40298693 主要内容: widgets 的组成是什么. 怎么创建 info.plist 文件 怎 ...

  3. Voyager下的Settings方法

    设置网站标题,logo,描述: 自定义setting字段,添加group为文章,key为title的字段: 添加成功: 前端页面写法: <img src="{{ Voyager::im ...

  4. Voyager下的关系模型

    关系:一个用户有几件商品,对应User表和Products表 在Products表下添加字段,user_id 打开products下的bread,点击Create Relationship Produ ...

  5. Voyager下的Media Manager文件管理与Menu Builder

    Media Manager 默认存储位置在storage/app/public 上传文件,新建文件夹,移动,重命名,删除等等等功能 Menu Builder 创建新的Main菜单 创建一个shop菜单 ...

  6. Voyager的安装及配置文件

    使用代理服务器安装laravel http_proxy=http://localhost:1080 composer create-project --prefer-dist laravel/lara ...

  7. Orchard官方文档翻译(十) 管理Widgets

    原文地址:http://docs.orchardproject.net/Documentation/Managing-widgets 想要查看文档目录请用力点击这里 最近想要学习了解orchard,但 ...

  8. Dashboard二次开发简明教程

    Horizon简介 Horizon是OpenStack的一个子项目,用于提供一个Web前端控制台(称为Dashboard),以此来展示OpenStack的功能.通常情况下,我们都是从Horizon.D ...

  9. kubernetes学习笔记之十一:kubernetes dashboard认证及分级授权

    第一章.部署dashboard 作为Kubernetes的Web用户界面,用户可以通过Dashboard在Kubernetes集群中部署容器化的应用,对应用进行问题处理和管理,并对集群本身进行管理.通 ...

随机推荐

  1. [题解](prufer)明明的烦恼

    https://www.cnblogs.com/noip/archive/2013/03/10/2952520.html 以及高精(抄 #include<iostream> #includ ...

  2. python数值类型与序列类型

    基本运算符 / 浮点除法 //整除 x**y  x的y次方 python中严格区分大小写 type(xx)/内置函数,查看变量xx的类型 id(xx)/内置函数,查看变量xx的内存地址 //----- ...

  3. springboot集成log4j

    需求: 1.springboot集成log4j 2.mybatis 打印 sql 实现: pom.xml <dependency> <groupId>org.springfra ...

  4. Spring 顾问

    1.名称匹配方法切入点顾问 接口:ISomeService public interface ISomeService { public void doSome(); public void doSe ...

  5. 开机报错 the connected AC adapter has a lower wattage than the recommended model which was shipped with the system。

    机型:联想Thinkpad T410 报错场景:在电脑插上电源充电情况下开机,会自动进入bios setup utility提示你需要重新设置日期时间.date/time 报错提示:The conne ...

  6. Emacs中自动刷新dired缓冲区

    Emacs中自动刷新dired缓冲区 在dired模式中,如果在不同buffer间切换,buffer不会自动更新,有时还需要手工按“g”键,比较麻烦,如下设置和代码能够在buffer切换和执行shel ...

  7. 一、单例模式(Singleton)

    单例模式最初的定义出现于<设计模式>(艾迪生维斯理, 1994):“保证一个类仅有一个实例,并提供一个访问它的全局访问点.” 特点:一是某个类只能有一个实例: 二是它必须自行创建这个实例: ...

  8. 像音乐播放App一样移动背景

    如果你经常听歌,你会发现歌曲app的背景会随着音乐移动的,从左到右或者从上到下,这种动画虽然简单,但是这里有一个技巧.如果你还不明白这种动效看看下面的demo (更多详细请参考:https://git ...

  9. Intellij IDEA项目添加资源文件

    添加了一个资源文件,但读取的时候出错了 prop.load(Config.class.getResourceAsStream("/resources/dbconfig.properties& ...

  10. reactnative资源

    http://facebook.github.io/react-native/docs/getting-started.html