sudo/vote

sudo包的投票

1.0.1 2020-10-07 06:59 UTC

This package is auto-updated.

Last update: 2024-09-07 16:08:50 UTC


README

介绍:这是SudoCms的评价模块。

默认情况下,该package将在/{admin_dir}/votes位置创建模块管理界面,其中admin_dir是在config('app.admin_dir')中设置的admin路径。

安装以使用

  • 该package需要base sudo/core来确保不会出现错误。
  • 要使用该package,需要按照以下命令composer require sudo/vote进行require。
  • 运行php artisan migrate以创建该package所需的服务器。
  • 运行php artisan vendor:publish --tag=sudo/vote以将配置文件和资源文件发布到外部。
  • 将命令@include('Vote::web.show', ['type'=>$table, 'type_id'=>$table_id])添加到想要显示评价功能的任何位置。
  • 在config/SudoVotes.php文件中的type数组中添加键值对,并在File中指定具有评价功能的页面。例如:'type' => [ 'pages' => '单页', 'products' => '产品', 'news' => '新闻', ]

在菜单中进行配置

[
	'type' 		=> 'single',
	'name' 		=> 'Đánh giá sao',
	'icon' 		=> 'fas fa-star',
	'route' 	=> 'admin.votes.index',
	'role'		=> 'votes_index'
],
  • 配置位置在config/SudoMenu.php
  • 为了在菜单中显示,可以将上述配置放在config('SudoMenu.menu')

在模块中进行配置

'votes' => [
	'name' 			=> 'Đánh giá sao',
	'permision' 	=> [
		[ 'type' => 'index', 'name' => 'Truy cập' ],
		[ 'type' => 'create', 'name' => 'Thêm' ],
		[ 'type' => 'edit', 'name' => 'Sửa' ],
		[ 'type' => 'restore', 'name' => 'Lấy lại' ],
		[ 'type' => 'delete', 'name' => 'Xóa' ],
	],
],
  • 配置位置在config/SudoModule.php
  • 为了进行权限分配,可以将上述配置放在config('SudoModule.modules')

注意

  • 该功能使用了Font Awesome图标,因此需要使用这个库。
  • 该功能在视图中直接插入了jQuery代码,因此需要在head标签中加载jQuery库以避免错误。