laravolt/epicentrum

此包已 弃用 并不再维护。未建议替代包。

Epic central 用户管理工具,适用于 Laravel

1.2.0 2020-01-07 14:14 UTC

README

安装

composer require laravolt/epicentrum

配置

使用命令发布配置文件

php artisan vendor:publish --tag=migrations --provider='Laravolt\Epicentrum\ServiceProvider

将会生成文件 config/laravolt/epicentrum.php,其中包含预配置的配置信息

<?php
return [
	// setting route
	'route' => [
		'enable' => true,
		'middleware' => ['web', 'auth'],
		'prefix' => 'epicentrum',
	],
	// base layout to extended
	'view' => [
		'layout' => 'ui::layouts.app',
	],
	// setting menu visibility to laravolt/ui
	'menu' => [
		'enable' => true,
	],
	// allow user to has multiple role
	'role' => [
		'multiple' => true,
		'editable' => true,
	],
	// list repository that you can modify
	'repository' => [
		// modify crud of user management
		'user' => \Laravolt\Epicentrum\Repositories\EloquentRepository::class,
		// set default time zone that used
		'timezone' => \Laravolt\Support\Repositories\TimezoneRepository::class,
		// change the criteria on searching feature
		'criteria' => [
			\Prettus\Repository\Criteria\RequestCriteria::class,
		],
		// specify column that can searchable
		'searchable' => ['name', 'email', 'status'],
	],
	'requests' => [
		// modify validation of store data crud
		'account' => [
			'store' => \Laravolt\Epicentrum\Http\Requests\Account\Store::class,
			'update' => \Laravolt\Epicentrum\Http\Requests\Account\Update::class,
			'delete' => \Laravolt\Epicentrum\Http\Requests\Account\Delete::class,
		],
	],
	// change user status available
	'user_available_status' => [
		'PENDING' => 'PENDING',
		'ACTIVE' => 'ACTIVE',
	],
	// specify the model of role
	'models' => [
		'role' => \Laravolt\Acl\Models\Role::class,
	],
	// Whether to auto load migrations or not.
    	// If set to false, then you must publish the migration files first before running the migrate command
    	'migrations' => true,
	// modify table view on user list page
    	'table_view' => \Laravolt\Epicentrum\Table\UserTable::class
];

自定义视图文件

您可以使用以下命令发布视图文件

php artisan vendor:publish --tag=views --provider='Laravolt\Epicentrum\ServiceProvider'

然后,您可以在 resources/views/vendor/epicentrum/* 中修改视图。

epicentrum 视图文件的结构

|-- account
|	|-- edit.blade.php
|-- emails
|	|-- account_information.blade.php
|-- my
|	|-- password
|		|-- edit.blade.php
|-- password
|	|-- edit.blade.php
|-- role
|	|-- edit.blade.php
|-- roles
|	|-- create.blade.php
|	|-- edit.blade.php
|	|-- index.blade.php
|-- create.blade.php
|-- edit.blade.php
|-- index.blade.php

常见问题解答

  • 如何覆盖控制器? 覆盖控制器不是最佳实践。如果您想将数据传递给视图,您需要使用 Laravel Blade 服务注入。如果您需要更改 重定向,您必须覆盖视图并自行创建自定义路由和控制器。然后扩展该控制器到 Epicentrum 控制器。