generated from liutk/owl-admin-base
编码风格
parent
7efc12327e
commit
970cef0c32
|
|
@ -6,48 +6,50 @@ use App\Models\Keyword;
|
|||
use Slowlyo\OwlAdmin\Renderers\BaseRenderer;
|
||||
use Slowlyo\OwlAdmin\Renderers\WangEditor;
|
||||
|
||||
class Components extends BaseRenderer {
|
||||
|
||||
class Components extends BaseRenderer
|
||||
{
|
||||
/**
|
||||
* 父级选择器
|
||||
*/
|
||||
public function parentControl($apiUrl = null, $name ='parent_id', $label = null, $labelField = 'name', $valueField = 'id')
|
||||
public function parentControl($apiUrl = null, $name = 'parent_id', $label = null, $labelField = 'name', $valueField = 'id')
|
||||
{
|
||||
return amisMake()->TreeSelectControl()->source($apiUrl)
|
||||
->name($name)->label($label ?? __('admin.components.parent_select'))
|
||||
->showIcon(false)
|
||||
->labelField($labelField)
|
||||
->valueField($valueField);
|
||||
->name($name)->label($label ?? __('admin.components.parent_select'))
|
||||
->showIcon(false)
|
||||
->labelField($labelField)
|
||||
->valueField($valueField);
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
public function sortControl($name ='sort', $label = null){
|
||||
public function sortControl($name = 'sort', $label = null)
|
||||
{
|
||||
return amisMake()->NumberControl()
|
||||
->name($name)->label($label ?? __('admin.components.order'))
|
||||
->displayMode('enhance')
|
||||
->value(0)
|
||||
->min(0);
|
||||
->name($name)->label($label ?? __('admin.components.order'))
|
||||
->displayMode('enhance')
|
||||
->value(0)
|
||||
->min(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2位小数输入框
|
||||
*/
|
||||
public function decimalControl($name ='decimal', $label = null){
|
||||
public function decimalControl($name = 'decimal', $label = null)
|
||||
{
|
||||
return amisMake()->NumberControl()
|
||||
->name($name)->label($label ?? __('admin.components.decimal'))
|
||||
->kilobitSeparator(true)
|
||||
->percision(2)
|
||||
->step(0.01)
|
||||
->value(0.00)
|
||||
->min(0);
|
||||
->name($name)->label($label ?? __('admin.components.decimal'))
|
||||
->kilobitSeparator(true)
|
||||
->percision(2)
|
||||
->step(0.01)
|
||||
->value(0.00)
|
||||
->min(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 富文本编辑器
|
||||
*/
|
||||
public function fuEditorControl($name ='content', $label = null, $height = 530)
|
||||
public function fuEditorControl($name = 'content', $label = null, $height = 530)
|
||||
{
|
||||
return WangEditor::make()
|
||||
->name($name)->label($label ?? __('admin.components.content'))
|
||||
|
|
@ -58,7 +60,8 @@ class Components extends BaseRenderer {
|
|||
/**
|
||||
* 开关
|
||||
*/
|
||||
public function enableControl($name = 'is_enable', $label= null, $mode = 'horizontal'){
|
||||
public function enableControl($name = 'is_enable', $label = null, $mode = 'horizontal')
|
||||
{
|
||||
return amisMake()->SwitchControl()
|
||||
->name($name)->label($label ?? __('admin.components.status'))
|
||||
->mode($mode)
|
||||
|
|
@ -68,39 +71,44 @@ class Components extends BaseRenderer {
|
|||
/**
|
||||
* 图片上传
|
||||
*/
|
||||
public function imageControl($name, $label){
|
||||
public function imageControl($name, $label)
|
||||
{
|
||||
return amis()->ImageControl($name, $label)
|
||||
->joinValues(false)
|
||||
->autoUpload(true)->maxSize('5*1024*1024');//不能大于5M
|
||||
->autoUpload(true)->maxSize('5*1024*1024'); //不能大于5M
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片上传,带裁剪
|
||||
*/
|
||||
public function cropImageControl($name, $label, $aspectRatio = null){
|
||||
public function cropImageControl($name, $label, $aspectRatio = null)
|
||||
{
|
||||
$cropImage = amis()->ImageControl($name, $label)->joinValues(false);
|
||||
// if($aspectRatio){
|
||||
$cropImage->crop([
|
||||
'aspectRatio' => $aspectRatio ?? 1
|
||||
]);
|
||||
$cropImage->crop([
|
||||
'aspectRatio' => $aspectRatio ?? 1,
|
||||
]);
|
||||
// }
|
||||
$cropImage->autoUpload(true);
|
||||
|
||||
return $cropImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通文件上传
|
||||
*/
|
||||
public function fileControl($name, $label, $accept = '.txt', $multiple = false){
|
||||
public function fileControl($name, $label, $accept = '.txt', $multiple = false)
|
||||
{
|
||||
return amis()->FileControl($name, $label ?? __('admin.components.files'))
|
||||
->multiple($multiple)
|
||||
->joinValues(false)
|
||||
->useChunk(false)
|
||||
->maxSize(20*1024*1024)
|
||||
->maxSize(20 * 1024 * 1024)
|
||||
->accept($accept);
|
||||
}
|
||||
|
||||
public function chunkFileControl($name, $label, $accept = '*', $multiple = false){
|
||||
public function chunkFileControl($name, $label, $accept = '*', $multiple = false)
|
||||
{
|
||||
return amis()->FileControl($name, $label ?? __('admin.components.files'))
|
||||
->multiple($multiple)
|
||||
->joinValues(false)
|
||||
|
|
@ -114,25 +122,28 @@ class Components extends BaseRenderer {
|
|||
/**
|
||||
* 标签选择
|
||||
*/
|
||||
public function keywordsTagControl($name = 'tags', $label= null, $pKey = null){
|
||||
public function keywordsTagControl($name = 'tags', $label = null, $pKey = null)
|
||||
{
|
||||
return amisMake()->TagControl()
|
||||
->name($name)->label($label ?? __('admin.components.tag'))
|
||||
->maxTagLength(0)
|
||||
->options(Keyword::where('parent_key', $pKey)->pluck('name', 'id')->toArray());
|
||||
}
|
||||
|
||||
public function keywordsTag($label = null, $color = null){
|
||||
if($color){
|
||||
public function keywordsTag($label = null, $color = null)
|
||||
{
|
||||
if ($color) {
|
||||
$tag = amisMake()->Tag()->label($label ?? __('admin.components.tag'))
|
||||
->displayMode('rounded')->style([
|
||||
->displayMode('rounded')->style([
|
||||
'color' => '#fff',
|
||||
'backgroundColor' =>$color,
|
||||
'borderColor' => $color
|
||||
'backgroundColor' => $color,
|
||||
'borderColor' => $color,
|
||||
]);
|
||||
}else{
|
||||
} else {
|
||||
$tag = amisMake()->Tag()->label($label ?? __('admin.components.tag'))
|
||||
->displayMode('rounded')->color('inactive');
|
||||
->displayMode('rounded')->color('inactive');
|
||||
}
|
||||
|
||||
return $tag;
|
||||
}
|
||||
|
||||
|
|
@ -140,36 +151,37 @@ class Components extends BaseRenderer {
|
|||
* 生成统计图config
|
||||
* 折线图或者柱状图
|
||||
*/
|
||||
public function chartLineBarConfig($title = null, array $x , array $y){
|
||||
public function chartLineBarConfig($title, array $x, array $y)
|
||||
{
|
||||
$yAxisData = [];
|
||||
$seriesData = [];
|
||||
$color = [];
|
||||
if(!isset($y[0])){
|
||||
if (! isset($y[0])) {
|
||||
$_y = $y;
|
||||
$y = [0=>$_y];
|
||||
$y = [0 => $_y];
|
||||
}
|
||||
$i = 0;
|
||||
$tips = '{b0}';
|
||||
foreach($y as $item) {
|
||||
foreach ($y as $item) {
|
||||
//调色盘
|
||||
$color[] = $item['color'];
|
||||
//tips
|
||||
$tips.= '<br/> {a'.$i.'}: {c'.$i.'}'.($item['unit'] ?? '');
|
||||
$tips .= '<br/> {a'.$i.'}: {c'.$i.'}'.($item['unit'] ?? '');
|
||||
//纵坐标
|
||||
$yAxisData[] = [
|
||||
'name'=>($item['unit'] ?? ''),
|
||||
'type' =>'value',
|
||||
'name' => ($item['unit'] ?? ''),
|
||||
'type' => 'value',
|
||||
'axisTick' => true,
|
||||
'alignTicks' => true,
|
||||
'axisLine' => [
|
||||
'show' => true,
|
||||
'lineStyle' => [
|
||||
'color' => $item['color'] ?? ''
|
||||
]
|
||||
'color' => $item['color'] ?? '',
|
||||
],
|
||||
],
|
||||
'axisLabel' => [
|
||||
'formatter' => '{value} ',
|
||||
],
|
||||
'axisLabel'=> [
|
||||
'formatter'=>'{value} '
|
||||
]
|
||||
];
|
||||
//数据
|
||||
$_series = [
|
||||
|
|
@ -178,16 +190,16 @@ class Components extends BaseRenderer {
|
|||
'type' => $item['type'] ?? 'line',
|
||||
'yAxisIndex' => $i,
|
||||
];
|
||||
switch($item['type']){
|
||||
switch ($item['type']) {
|
||||
case 'line':
|
||||
$_series = array_merge($_series, [
|
||||
'smooth'=> true,
|
||||
'symbol'=> 'none',
|
||||
'smooth' => true,
|
||||
'symbol' => 'none',
|
||||
'lineStyle' => [
|
||||
'color' => $item['color'] ?? ''
|
||||
'color' => $item['color'] ?? '',
|
||||
],
|
||||
'areaStyle' => [
|
||||
'color' => $item['color'] ?? ''
|
||||
'color' => $item['color'] ?? '',
|
||||
],
|
||||
]);
|
||||
break;
|
||||
|
|
@ -201,14 +213,14 @@ class Components extends BaseRenderer {
|
|||
}
|
||||
|
||||
return [
|
||||
'color' => $color,
|
||||
'color' => $color,
|
||||
'title' => [
|
||||
'text' => $title,
|
||||
],
|
||||
"tooltip" => [//提示
|
||||
'trigger'=>'axis',//坐标轴触发
|
||||
'tooltip' => [//提示
|
||||
'trigger' => 'axis', //坐标轴触发
|
||||
'axisPointer' => [
|
||||
'type' => 'cross'
|
||||
'type' => 'cross',
|
||||
],
|
||||
// 'formatter' => $tips
|
||||
],
|
||||
|
|
@ -221,21 +233,22 @@ class Components extends BaseRenderer {
|
|||
'data' => $x,
|
||||
],
|
||||
'yAxis' => $yAxisData,
|
||||
'series' => $seriesData
|
||||
'series' => $seriesData,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 散点图
|
||||
*/
|
||||
public function chartScatterConfig($title = null, array $x , array $y, array $yData = null){
|
||||
public function chartScatterConfig($title, array $x, array $y, ?array $yData = null)
|
||||
{
|
||||
$yAxisData = [];
|
||||
$seriesData = [];
|
||||
$color = [];
|
||||
|
||||
if($yData){
|
||||
if ($yData) {
|
||||
$yAxisData = [
|
||||
'type' =>'category',
|
||||
'type' => 'category',
|
||||
// 'splitLine'=>[
|
||||
// 'show'=>true,
|
||||
// 'lineStyle'=>[
|
||||
|
|
@ -243,23 +256,23 @@ class Components extends BaseRenderer {
|
|||
// ]
|
||||
// ],
|
||||
'axisTick' => [
|
||||
'alignWithLabel'=>true
|
||||
'alignWithLabel' => true,
|
||||
],
|
||||
'data'=> $yData
|
||||
'data' => $yData,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
$seriesData = $y;
|
||||
|
||||
|
||||
return [
|
||||
'color' => $color,
|
||||
'color' => $color,
|
||||
'title' => [
|
||||
'text' => $title,
|
||||
],
|
||||
"tooltip" => [//提示
|
||||
'trigger'=>'axis',//坐标轴触发
|
||||
'tooltip' => [//提示
|
||||
'trigger' => 'axis', //坐标轴触发
|
||||
'axisPointer' => [
|
||||
'type' => 'cross'
|
||||
'type' => 'cross',
|
||||
],
|
||||
],
|
||||
'xAxis' => [
|
||||
|
|
@ -267,7 +280,7 @@ class Components extends BaseRenderer {
|
|||
'data' => $x,
|
||||
],
|
||||
'yAxis' => $yAxisData,
|
||||
'series' => $seriesData
|
||||
'series' => $seriesData,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -275,7 +288,8 @@ class Components extends BaseRenderer {
|
|||
* 生成饼状图config
|
||||
* -todo
|
||||
*/
|
||||
public function chartPieConfig(){
|
||||
return ;
|
||||
public function chartPieConfig()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,14 +31,14 @@ class AdController extends AdminController
|
|||
->filter($this->baseFilter()->labelWidth('80px')->body([
|
||||
amis()->GroupControl()->mode('horizontal')->body([
|
||||
amis()->TextControl('id', __('admin.ads.id'))
|
||||
->placeholder(__('admin.id')),
|
||||
->placeholder(__('admin.id')),
|
||||
amis()->TextControl('remark', __('admin.ads.remark'))
|
||||
->placeholder(__('admin.ads.remark')),
|
||||
->placeholder(__('admin.ads.remark')),
|
||||
Components::make()->parentControl(admin_url('api/keywords/tree-list?parent_name=banner_address&has_owner=0'), 'address', __('admin.ads.address'), 'name', 'key'),
|
||||
amis()->SelectControl('enable', __('admin.ads.is_enable'))
|
||||
->options([
|
||||
1=>'开启',0=>'关闭'
|
||||
]),
|
||||
->options([
|
||||
1 => '开启', 0 => '关闭',
|
||||
]),
|
||||
]),
|
||||
amis()->GroupControl()->mode('horizontal')->body([
|
||||
amis()->InputDatetimeRange()->label(__('admin.ads.published_at'))->name('published_at'),
|
||||
|
|
@ -54,14 +54,14 @@ class AdController extends AdminController
|
|||
amis()->NumberControl()->min(0)->saveImmediately(true)
|
||||
),
|
||||
amis()->TableColumn('resource', __('admin.ads.resource'))->type('image')->height('50px')->width('150px')->enlargeAble(true),
|
||||
amis()->TableColumn('remark', __('admin.ads.remark')),
|
||||
amis()->TableColumn('remark', __('admin.ads.remark')),
|
||||
amis()->TableColumn('published_at', __('admin.ads.published_at'))->remark(__('admin.ads.published_at_remark')),
|
||||
amis()->TableColumn('is_enable', __('admin.ads.is_enable'))->type('switch'),
|
||||
amis()->TableColumn('created_at', __('admin.created_at'))->type('datetime')->sortable(true),
|
||||
amis()->TableColumn('created_at', __('admin.created_at'))->type('datetime')->sortable(true),
|
||||
Operation::make()->label(__('admin.actions'))->buttons([
|
||||
$this->rowEditButton(),
|
||||
$this->rowDeleteButton(),
|
||||
])
|
||||
]),
|
||||
]);
|
||||
|
||||
return $this->baseList($crud);
|
||||
|
|
@ -71,7 +71,7 @@ class AdController extends AdminController
|
|||
{
|
||||
return $this->baseForm()->body([
|
||||
Components::make()->parentControl(admin_url('api/keywords/tree-list?parent_name=banner_address&has_owner=0'), 'address', __('admin.ads.address'), 'name', 'key')->required(true),
|
||||
Components::make()->imageControl('resource', __('admin.ads.resource'))->required(true),
|
||||
Components::make()->imageControl('resource', __('admin.ads.resource'))->required(true),
|
||||
amis()->TextControl('remark', __('admin.ads.remark')),
|
||||
Components::make()->sortControl('sort', __('admin.ads.sort')),
|
||||
amis()->DateTimeControl('published_at', __('admin.ads.published_at'))->format('YYYY-MM-DD HH:mm:ss')->description(__('admin.ads.published_at_remark')),
|
||||
|
|
@ -90,8 +90,8 @@ class AdController extends AdminController
|
|||
{
|
||||
return $this->baseDetail()->body([
|
||||
amis()->TextControl('id', 'ID')->static(),
|
||||
amis()->TextControl('created_at', __('admin.created_at'))->static(),
|
||||
amis()->TextControl('updated_at', __('admin.updated_at'))->static()
|
||||
amis()->TextControl('created_at', __('admin.created_at'))->static(),
|
||||
amis()->TextControl('updated_at', __('admin.updated_at'))->static(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use Slowlyo\OwlAdmin\Renderers\Page;
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminRoleController as AdminRoleBaseController;
|
||||
use Slowlyo\OwlAdmin\Renderers\Page;
|
||||
|
||||
class AdminRoleController extends AdminRoleBaseController
|
||||
{
|
||||
|
|
@ -38,13 +38,13 @@ class AdminRoleController extends AdminRoleBaseController
|
|||
]);
|
||||
|
||||
return $this->baseList($crud)->css([
|
||||
'.tree-full' => [
|
||||
'.tree-full' => [
|
||||
'overflow' => 'hidden !important',
|
||||
],
|
||||
'.cxd-TreeControl > .cxd-Tree' => [
|
||||
'height' => '100% !important',
|
||||
'height' => '100% !important',
|
||||
'max-height' => '100% !important',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ class AdminUserController extends AdminController
|
|||
amisMake()->Dialog()->title(__('admin.admin_user.edit_password'))->body([
|
||||
amisMake()->Form()->title('')
|
||||
->api([
|
||||
'method'=>'PUT',
|
||||
'url'=> admin_url('system/admin_users/$id')
|
||||
'method' => 'PUT',
|
||||
'url' => admin_url('system/admin_users/$id'),
|
||||
])
|
||||
->body([
|
||||
amisMake()->TextControl('id')->value('${id}')->hidden(true),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ namespace App\Admin\Controllers;
|
|||
|
||||
use App\Admin\Components;
|
||||
use App\Admin\Services\ArticleService;
|
||||
use App\Casts\Storage;
|
||||
use App\Models\Keyword;
|
||||
use App\Traits\CustomActionTrait;
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
|
|
@ -15,9 +14,10 @@ use Slowlyo\OwlAdmin\Renderers\Page;
|
|||
class ArticleController extends AdminController
|
||||
{
|
||||
use CustomActionTrait;
|
||||
|
||||
protected string $serviceName = ArticleService::class;
|
||||
|
||||
public function list():Page
|
||||
public function list(): Page
|
||||
{
|
||||
$crud = $this->baseCRUD()->tableLayout('fixed')
|
||||
->headerToolbar([
|
||||
|
|
@ -27,9 +27,9 @@ class ArticleController extends AdminController
|
|||
->filter($this->baseFilter()->body([
|
||||
amis()->GroupControl()->mode('horizontal')->body([
|
||||
amis()->TextControl('id', __('admin.articles.id'))
|
||||
->placeholder(__('admin.id')),
|
||||
->placeholder(__('admin.id')),
|
||||
amis()->TextControl('title', __('admin.articles.title'))
|
||||
->placeholder(__('admin.articles.title')),
|
||||
->placeholder(__('admin.articles.title')),
|
||||
Components::make()->parentControl(admin_url('api/keywords/tree-list?parent_name=article_category&has_owner=0'), 'category', __('admin.articles.category'), 'name', 'key'),
|
||||
Components::make()->keywordsTagControl('t_ids', __('admin.articles.tags'), 'article_tag'),
|
||||
]),
|
||||
|
|
@ -37,12 +37,12 @@ class ArticleController extends AdminController
|
|||
amis()->SelectControl('enable', __('admin.articles.is_enable'))
|
||||
->columnRatio(3)
|
||||
->options([
|
||||
1=>'开启',0=>'关闭'
|
||||
1 => '开启', 0 => '关闭',
|
||||
]),
|
||||
amis()->SelectControl('recommend', __('admin.articles.is_recommend'))
|
||||
->columnRatio(3)
|
||||
->options([
|
||||
1=>'开启',0=>'关闭'
|
||||
1 => '开启', 0 => '关闭',
|
||||
]),
|
||||
amis()->InputDatetimeRange()->label(__('admin.articles.published_at'))->name('published_at'),
|
||||
]),
|
||||
|
|
@ -56,7 +56,7 @@ class ArticleController extends AdminController
|
|||
'position' => 'top-left',
|
||||
'badgeLevel' => 'danger',
|
||||
'visibleOn' => '${is_recommend > 0}',
|
||||
'size' => 15
|
||||
'size' => 15,
|
||||
])
|
||||
->columns([
|
||||
amis()->TableColumn('id', __('admin.id'))->sortable(true),
|
||||
|
|
@ -73,7 +73,7 @@ class ArticleController extends AdminController
|
|||
amis()->Operation()->label(__('admin.actions'))->buttons([
|
||||
$this->rowEditTypeButton('drawer', 'xl'),
|
||||
$this->rowDeleteButton(),
|
||||
])
|
||||
]),
|
||||
]);
|
||||
|
||||
return $this->baseList($crud);
|
||||
|
|
@ -84,10 +84,10 @@ class ArticleController extends AdminController
|
|||
return $this->baseForm()->panelClassName('px-0')->body([
|
||||
amis()->Grid()->columns([
|
||||
amis()->Wrapper()->body([
|
||||
amis()->TextControl('title', __('admin.articles.title'))->required(true),
|
||||
amis()->TextControl('title', __('admin.articles.title'))->required(true),
|
||||
Components::make()->parentControl(admin_url('api/keywords/tree-list?parent_name=article_category&has_owner=0'), 'category', __('admin.articles.category'), 'name', 'key'),
|
||||
Components::make()->keywordsTagControl('t_ids', __('admin.articles.tags'), 'article_tag'),
|
||||
Components::make()->cropImageControl('cover', __('admin.articles.cover')),
|
||||
Components::make()->cropImageControl('cover', __('admin.articles.cover')),
|
||||
Components::make()->sortControl('sort', __('admin.articles.sort')),
|
||||
amis()->DateTimeControl('published_at', __('admin.articles.published_at'))->format('YYYY-MM-DD HH:mm:ss')->description(__('admin.articles.published_at_remark')),
|
||||
amis()->SwitchControl('is_enable', __('admin.articles.is_enable'))->value(false),
|
||||
|
|
@ -96,7 +96,7 @@ class ArticleController extends AdminController
|
|||
])->md(4),
|
||||
amis()->Wrapper()->body([
|
||||
Components::make()->fuEditorControl('content', __('admin.articles.content')),
|
||||
])->md(8)
|
||||
])->md(8),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
|
@ -105,5 +105,4 @@ class ArticleController extends AdminController
|
|||
{
|
||||
return $this->baseDetail()->body([]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,19 +2,19 @@
|
|||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Slowlyo\OwlAdmin\Controllers\AuthController as AdminAuthController;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
use Slowlyo\OwlAdmin\Controllers\AuthController as AdminAuthController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class AuthController extends AdminAuthController
|
||||
{
|
||||
public function login(Request $request)
|
||||
{
|
||||
if (Admin::config('admin.auth.login_captcha')) {
|
||||
if (!$request->has('captcha')) {
|
||||
if (! $request->has('captcha')) {
|
||||
return $this->response()->fail(__('admin.required', ['attribute' => __('admin.captcha')]));
|
||||
}
|
||||
|
||||
|
|
@ -28,8 +28,8 @@ class AuthController extends AdminAuthController
|
|||
'username' => 'required',
|
||||
'password' => 'required',
|
||||
], [
|
||||
'username' . '.required' => __('admin.required', ['attribute' => __('admin.username')]),
|
||||
'password.required' => __('admin.required', ['attribute' => __('admin.password')]),
|
||||
'username'.'.required' => __('admin.required', ['attribute' => __('admin.username')]),
|
||||
'password.required' => __('admin.required', ['attribute' => __('admin.password')]),
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
|
@ -37,15 +37,16 @@ class AuthController extends AdminAuthController
|
|||
}
|
||||
|
||||
$adminModel = Admin::adminUserModel();
|
||||
$user = $adminModel::query()->where('username', $request->username)->first();
|
||||
$user = $adminModel::query()->where('username', $request->username)->first();
|
||||
|
||||
if($user && $user->lock){
|
||||
if ($user && $user->lock) {
|
||||
abort(Response::HTTP_BAD_REQUEST, '您的账号已被锁定,需要联系超级管理员解锁。');
|
||||
}else{
|
||||
} else {
|
||||
if ($user && Hash::check($request->password, $user->password)) {
|
||||
$module = Admin::currentModule(true);
|
||||
$prefix = $module ? $module . '.' : '';
|
||||
$token = $user->createToken($prefix . 'admin')->plainTextToken;
|
||||
$prefix = $module ? $module.'.' : '';
|
||||
$token = $user->createToken($prefix.'admin')->plainTextToken;
|
||||
|
||||
return $this->response()->success(compact('token'), __('admin.login_successful'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@
|
|||
namespace App\Admin\Controllers;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Slowlyo\OwlAdmin\Renderers\Card;
|
||||
use Slowlyo\OwlAdmin\Renderers\Flex;
|
||||
use Slowlyo\OwlAdmin\Renderers\Html;
|
||||
use Slowlyo\OwlAdmin\Renderers\Grid;
|
||||
use Slowlyo\OwlAdmin\Renderers\Chart;
|
||||
use Slowlyo\OwlAdmin\Renderers\Image;
|
||||
use Slowlyo\OwlAdmin\Renderers\Action;
|
||||
use Slowlyo\OwlAdmin\Renderers\Custom;
|
||||
use Slowlyo\OwlAdmin\Renderers\Wrapper;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||
use Slowlyo\OwlAdmin\Renderers\Action;
|
||||
use Slowlyo\OwlAdmin\Renderers\Card;
|
||||
use Slowlyo\OwlAdmin\Renderers\Chart;
|
||||
use Slowlyo\OwlAdmin\Renderers\Custom;
|
||||
use Slowlyo\OwlAdmin\Renderers\Flex;
|
||||
use Slowlyo\OwlAdmin\Renderers\Grid;
|
||||
use Slowlyo\OwlAdmin\Renderers\Html;
|
||||
use Slowlyo\OwlAdmin\Renderers\Image;
|
||||
use Slowlyo\OwlAdmin\Renderers\Wrapper;
|
||||
|
||||
class HomeController extends AdminController
|
||||
{
|
||||
|
|
@ -47,7 +47,7 @@ class HomeController extends AdminController
|
|||
return Card::make()
|
||||
->className('h-full clear-card-mb')
|
||||
->body(
|
||||
Custom::make()->html(<<<HTML
|
||||
Custom::make()->html(<<<'HTML'
|
||||
<div class="h-full flex flex-col mt-5 py-5 px-7">
|
||||
<div>『</div>
|
||||
<div class="flex flex-1 items-center w-full justify-center" id="hitokoto">
|
||||
|
|
@ -64,12 +64,12 @@ class HomeController extends AdminController
|
|||
</div>
|
||||
HTML
|
||||
|
||||
)->onMount(<<<JS
|
||||
)->onMount(<<<'JS'
|
||||
fetch('https://v1.hitokoto.cn?c=i')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const hitokoto = document.querySelector('#hitokoto_text')
|
||||
hitokoto.href = `https://hitokoto.cn/?uuid=\${data.uuid}`
|
||||
hitokoto.href = `https://hitokoto.cn/?uuid=${data.uuid}`
|
||||
hitokoto.innerText = data.hitokoto
|
||||
document.querySelector('#hitokoto_from_who').innerText = data.from_who
|
||||
document.querySelector('#hitokoto_from').innerText = data.from
|
||||
|
|
@ -88,7 +88,7 @@ JS
|
|||
Custom::make()
|
||||
->name('clock')
|
||||
->html('<div id="clock" class="text-4xl"></div><div id="clock-date" class="mt-5"></div>')
|
||||
->onMount(<<<JS
|
||||
->onMount(<<<'JS'
|
||||
const clock = document.getElementById('clock');
|
||||
const tick = () => {
|
||||
clock.innerHTML = (new Date()).toLocaleTimeString();
|
||||
|
|
@ -176,7 +176,8 @@ JS
|
|||
for ($i = 0; $i < 7; $i++) {
|
||||
$_arr[] = random_int(10, 200);
|
||||
}
|
||||
return '[' . implode(',', $_arr) . ']';
|
||||
|
||||
return '['.implode(',', $_arr).']';
|
||||
};
|
||||
|
||||
$random1 = $randArr();
|
||||
|
|
@ -201,7 +202,7 @@ series: [
|
|||
public function cube(): Card
|
||||
{
|
||||
return Card::make()->className('h-96 ml-4 w-8/12')->body(
|
||||
Html::make()->html(<<<HTML
|
||||
Html::make()->html(<<<'HTML'
|
||||
<style>
|
||||
.cube-box{ height: 300px; display: flex; align-items: center; justify-content: center; }
|
||||
.cube { width: 100px; height: 100px; position: relative; transform-style: preserve-3d; animation: rotate 10s linear infinite; }
|
||||
|
|
@ -256,20 +257,20 @@ HTML
|
|||
private function css(): array
|
||||
{
|
||||
return [
|
||||
'.clear-card-mb' => [
|
||||
'.clear-card-mb' => [
|
||||
'margin-bottom' => '0 !important',
|
||||
],
|
||||
'.cxd-Image' => [
|
||||
'.cxd-Image' => [
|
||||
'border' => '0',
|
||||
],
|
||||
'.bg-blingbling' => [
|
||||
'color' => '#fff',
|
||||
'background' => 'linear-gradient(to bottom right, #2C3E50, #FD746C, #FF8235, #ffff1c, #92FE9D, #00C9FF, #a044ff, #e73827)',
|
||||
'.bg-blingbling' => [
|
||||
'color' => '#fff',
|
||||
'background' => 'linear-gradient(to bottom right, #2C3E50, #FD746C, #FF8235, #ffff1c, #92FE9D, #00C9FF, #a044ff, #e73827)',
|
||||
'background-repeat' => 'no-repeat',
|
||||
'background-size' => '1000% 1000%',
|
||||
'animation' => 'gradient 60s ease infinite',
|
||||
'background-size' => '1000% 1000%',
|
||||
'animation' => 'gradient 60s ease infinite',
|
||||
],
|
||||
'@keyframes gradient' => [
|
||||
'@keyframes gradient' => [
|
||||
'0%{background-position:0% 0%}
|
||||
50%{background-position:100% 100%}
|
||||
100%{background-position:0% 0%}',
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class EmployeeController extends AdminController
|
|||
->level('link')
|
||||
->icon('fa fa-sign-out')
|
||||
->confirmText(__('employee.leave_confirm'))
|
||||
->api('post:' . admin_url('hr/employees/${id}/leave')),
|
||||
->api('post:'.admin_url('hr/employees/${id}/leave')),
|
||||
]),
|
||||
]);
|
||||
|
||||
|
|
@ -58,14 +58,14 @@ class EmployeeController extends AdminController
|
|||
amisMake()->TextControl()->name('phone')->label(__('employee.phone'))->required(),
|
||||
|
||||
amisMake()->TagControl()->name('jobs')->label(__('employee.jobs'))
|
||||
->source(admin_url('api/keywords/tree-list') . '?parent_key=' . Employee::JOB_KEY)
|
||||
->source(admin_url('api/keywords/tree-list').'?parent_key='.Employee::JOB_KEY)
|
||||
->labelField('name')
|
||||
->valueField('key')
|
||||
->joinValues(),
|
||||
amisMake()->DateControl()->name('join_at')->label(__('employee.join_at'))->format('YYYY-MM-DD'),
|
||||
amisMake()->TextControl()->name('username')->label(__('admin.username'))->value('${admin_user.username}')->required(!$edit),
|
||||
amisMake()->TextControl()->name('password')->set('type', 'input-password')->label(__('admin.password'))->required(!$edit),
|
||||
amisMake()->TextControl()->name('confirm_password')->set('type', 'input-password')->label(__('admin.confirm_password'))->required(!$edit),
|
||||
amisMake()->TextControl()->name('username')->label(__('admin.username'))->value('${admin_user.username}')->required(! $edit),
|
||||
amisMake()->TextControl()->name('password')->set('type', 'input-password')->label(__('admin.password'))->required(! $edit),
|
||||
amisMake()->TextControl()->name('confirm_password')->set('type', 'input-password')->label(__('admin.confirm_password'))->required(! $edit),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||
use App\Traits\UploadTrait;
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||
|
||||
class IndexController extends AdminController
|
||||
{
|
||||
use UploadTrait;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ class KeywordController extends AdminController
|
|||
->placeholder(__('admin.keywords.search_name')),
|
||||
amis()->TextControl('parent_name', __('admin.keywords.parent_keyword'))
|
||||
->size('md')
|
||||
->placeholder(__('admin.keywords.search_name'))
|
||||
]
|
||||
->placeholder(__('admin.keywords.search_name')),
|
||||
]
|
||||
))
|
||||
->columns([
|
||||
// TableColumn::make()->name('id')->label('ID')->sortable(true),
|
||||
|
|
@ -42,7 +42,7 @@ class KeywordController extends AdminController
|
|||
TableColumn::make()->name('key')->label('KEY')->copyable(true),
|
||||
TableColumn::make()->name('value')->label('值'),
|
||||
TableColumn::make()->name('sort')->label('排序'),
|
||||
TableColumn::make()->name('created_at')->label('创建时间')->type('datetime')->sortable(true),
|
||||
TableColumn::make()->name('created_at')->label('创建时间')->type('datetime')->sortable(true),
|
||||
amisMake()->Operation()->label(__('admin.actions'))->buttons([
|
||||
$this->rowEditButton(true),
|
||||
$this->rowDeleteButton(),
|
||||
|
|
@ -63,7 +63,8 @@ class KeywordController extends AdminController
|
|||
]);
|
||||
}
|
||||
|
||||
public function getTreeList(Request $request){
|
||||
return $this->service->getTree();
|
||||
}
|
||||
public function getTreeList(Request $request)
|
||||
{
|
||||
return $this->service->getTree();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,14 +2,11 @@
|
|||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||
use Slowlyo\OwlAdmin\Renderers\Tab;
|
||||
use Slowlyo\OwlAdmin\Renderers\Tabs;
|
||||
use Slowlyo\OwlAdmin\Renderers\Alert;
|
||||
use Slowlyo\OwlAdmin\Renderers\InputKV;
|
||||
use Slowlyo\OwlAdmin\Renderers\TextControl;
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||
|
||||
class SettingController extends AdminController
|
||||
{
|
||||
|
|
@ -32,7 +29,7 @@ class SettingController extends AdminController
|
|||
Tabs::make()->tabs([
|
||||
Tab::make()->title('上传设置')->body([
|
||||
amis()->RadiosControl('upload_disk', '上传驱动')->options([
|
||||
'public'=>'本地存储',
|
||||
'public' => '本地存储',
|
||||
'oss' => '阿里云OSS',
|
||||
])->value('public')->required(true),
|
||||
amis()->TextControl('oss_config.access_key_id', '阿里云AccessKeyId')->required(true)->size('lg')->visibleOn('${upload_disk == "oss"}'),
|
||||
|
|
@ -41,7 +38,7 @@ class SettingController extends AdminController
|
|||
amis()->TextControl('oss_config.endpoint', '对象存储endpoint')->required(true)->size('lg')->visibleOn('${upload_disk == "oss"}')->remark('示例: oss-cn-shanghai.aliyuncs.com'),
|
||||
amis()->TextControl('oss_config.domain', '自有域名')->size('lg')->visibleOn('${upload_disk == "oss"}')->remark('填写即启用 示例: my-domain.com'),
|
||||
amis()->SwitchControl('oss_config.use_ssl', '开启SSL')->value(false)->visibleOn('${upload_disk == "oss"}'),
|
||||
]),
|
||||
]),
|
||||
])
|
||||
);
|
||||
}
|
||||
|
|
@ -50,41 +47,41 @@ class SettingController extends AdminController
|
|||
{
|
||||
$data = $request->only([
|
||||
'upload_disk',
|
||||
'oss_config'
|
||||
'oss_config',
|
||||
]);
|
||||
|
||||
//上传设置-修改env文件内配置;
|
||||
if(!empty($data['upload_disk'])){
|
||||
if (! empty($data['upload_disk'])) {
|
||||
$envData['FILESYSTEM_DISK'] = $data['upload_disk'];
|
||||
if($envData['FILESYSTEM_DISK'] == 'oss'){//如果设置为OSS驱动,则配置env变量
|
||||
if ($envData['FILESYSTEM_DISK'] == 'oss') {//如果设置为OSS驱动,则配置env变量
|
||||
$envData['OSS_ACCESS_KEY_ID'] = Arr::get($data['oss_config'], 'access_key_id');
|
||||
$envData['OSS_ACCESS_KEY_SECRET'] = Arr::get($data['oss_config'], 'access_key_secret');
|
||||
$envData['OSS_BUCKET'] = Arr::get($data['oss_config'], 'bucket');
|
||||
$envData['OSS_ENDPOINT'] = Arr::get($data['oss_config'], 'endpoint');
|
||||
$envData['OSS_DOMAIN'] = Arr::get($data['oss_config'], 'domain');
|
||||
if(!empty($envData['OSS_DOMAIN'])){
|
||||
if (! empty($envData['OSS_DOMAIN'])) {
|
||||
$envData['OSS_CNAME'] = 'true';
|
||||
}else{
|
||||
} else {
|
||||
$envData['OSS_CNAME'] = 'false';
|
||||
}
|
||||
$envData['OSS_SSL'] = Arr::get($data['oss_config'], 'use_ssl') ? 'true':'false';
|
||||
$envData['OSS_SSL'] = Arr::get($data['oss_config'], 'use_ssl') ? 'true' : 'false';
|
||||
}
|
||||
$envPath = base_path() . DIRECTORY_SEPARATOR . '.env';
|
||||
$envPath = base_path().DIRECTORY_SEPARATOR.'.env';
|
||||
$contentArray = collect(file($envPath, FILE_IGNORE_NEW_LINES));
|
||||
$contentArray->transform(function ($item) use ($envData){
|
||||
foreach ($envData as $key => $value){
|
||||
if(str_contains($item, $key)){
|
||||
|
||||
return $key . '=' . $value;
|
||||
$contentArray->transform(function ($item) use ($envData) {
|
||||
foreach ($envData as $key => $value) {
|
||||
if (str_contains($item, $key)) {
|
||||
|
||||
return $key.'='.$value;
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
});
|
||||
|
||||
$content = implode("\n", $contentArray->toArray());
|
||||
\File::put($envPath, $content);
|
||||
}
|
||||
|
||||
|
||||
return settings()->adminSetMany($data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class StoreController extends AdminController
|
|||
->extractValue(false)
|
||||
->clearable(),
|
||||
amisMake()->SelectControl()->name('business_status')->label(__('store.business_status'))->columnRatio(3)->clearable(),
|
||||
])
|
||||
]),
|
||||
]))
|
||||
->columns([
|
||||
amisMake()->TableColumn()->name('id')->label(__('store.id')),
|
||||
|
|
@ -62,6 +62,7 @@ class StoreController extends AdminController
|
|||
$this->rowDeleteButton(),
|
||||
]),
|
||||
]);
|
||||
|
||||
return $this->baseList($crud);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Admin\Filters;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use EloquentFilter\ModelFilter;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class AdFilter extends ModelFilter
|
||||
{
|
||||
|
|
@ -14,12 +14,13 @@ class AdFilter extends ModelFilter
|
|||
{
|
||||
return $this->where('id', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
public function remark($remark)
|
||||
{
|
||||
return $this->where('remark','like', '%'.$remark.'%');
|
||||
return $this->where('remark', 'like', '%'.$remark.'%');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -29,35 +30,41 @@ class AdFilter extends ModelFilter
|
|||
{
|
||||
return $this->where('address', $address);
|
||||
}
|
||||
public function publishedAt($publishedAt){
|
||||
$publishedAt = explode(',',$publishedAt);
|
||||
return $this->where(function($q) use ($publishedAt) {
|
||||
|
||||
public function publishedAt($publishedAt)
|
||||
{
|
||||
$publishedAt = explode(',', $publishedAt);
|
||||
|
||||
return $this->where(function ($q) use ($publishedAt) {
|
||||
$startAt = Arr::get($publishedAt, 0) ?? null;
|
||||
$endAt = Arr::get($publishedAt, 1) ?? null;
|
||||
if(!empty($startAt)){
|
||||
if (! empty($startAt)) {
|
||||
$q->where('published_at', '>=', $startAt);
|
||||
}
|
||||
if(!empty($endAt)){
|
||||
if (! empty($endAt)) {
|
||||
$q->where('published_at', '<=', $endAt);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function createdAt($createdAt){
|
||||
$createdAt = explode(',',$createdAt);
|
||||
return $this->where(function($q) use ($createdAt) {
|
||||
public function createdAt($createdAt)
|
||||
{
|
||||
$createdAt = explode(',', $createdAt);
|
||||
|
||||
return $this->where(function ($q) use ($createdAt) {
|
||||
$startAt = Arr::get($createdAt, 0) ?? null;
|
||||
$endAt = Arr::get($createdAt, 1) ?? null;
|
||||
if(!empty($startAt)){
|
||||
if (! empty($startAt)) {
|
||||
$q->where('created_at', '>=', $startAt);
|
||||
}
|
||||
if(!empty($endAt)){
|
||||
if (! empty($endAt)) {
|
||||
$q->where('created_at', '<=', $endAt);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function enable($enable){
|
||||
public function enable($enable)
|
||||
{
|
||||
return $this->where('is_enable', $enable);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,12 +14,13 @@ class ArticleFilter extends ModelFilter
|
|||
{
|
||||
return $this->where('id', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
public function title($title)
|
||||
{
|
||||
return $this->where('title','like', '%'.$title.'%');
|
||||
return $this->where('title', 'like', '%'.$title.'%');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -33,48 +34,56 @@ class ArticleFilter extends ModelFilter
|
|||
/**
|
||||
* 查询带有标签的文章
|
||||
*/
|
||||
public function tIds($tIds){
|
||||
$tIds = explode(',',$tIds);
|
||||
return $this->where(function($q) use ($tIds) {
|
||||
public function tIds($tIds)
|
||||
{
|
||||
$tIds = explode(',', $tIds);
|
||||
|
||||
return $this->where(function ($q) use ($tIds) {
|
||||
foreach ($tIds as $tId) {
|
||||
$q->whereRaw("FIND_IN_SET('".$tId."',t_ids)");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function publishedAt($publishedAt){
|
||||
$publishedAt = explode(',',$publishedAt);
|
||||
return $this->where(function($q) use ($publishedAt) {
|
||||
public function publishedAt($publishedAt)
|
||||
{
|
||||
$publishedAt = explode(',', $publishedAt);
|
||||
|
||||
return $this->where(function ($q) use ($publishedAt) {
|
||||
$startAt = Arr::get($publishedAt, 0) ?? null;
|
||||
$endAt = Arr::get($publishedAt, 1) ?? null;
|
||||
if(!empty($startAt)){
|
||||
if (! empty($startAt)) {
|
||||
$q->where('published_at', '>=', $startAt);
|
||||
}
|
||||
if(!empty($endAt)){
|
||||
if (! empty($endAt)) {
|
||||
$q->where('published_at', '<=', $endAt);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function createdAt($createdAt){
|
||||
$createdAt = explode(',',$createdAt);
|
||||
return $this->where(function($q) use ($createdAt) {
|
||||
public function createdAt($createdAt)
|
||||
{
|
||||
$createdAt = explode(',', $createdAt);
|
||||
|
||||
return $this->where(function ($q) use ($createdAt) {
|
||||
$startAt = Arr::get($createdAt, 0) ?? null;
|
||||
$endAt = Arr::get($createdAt, 1) ?? null;
|
||||
if(!empty($startAt)){
|
||||
if (! empty($startAt)) {
|
||||
$q->where('created_at', '>=', $startAt);
|
||||
}
|
||||
if(!empty($endAt)){
|
||||
if (! empty($endAt)) {
|
||||
$q->where('created_at', '<=', $endAt);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function enable($enable){
|
||||
public function enable($enable)
|
||||
{
|
||||
return $this->where('is_enable', $enable);
|
||||
}
|
||||
|
||||
public function recommend($recommend){
|
||||
public function recommend($recommend)
|
||||
{
|
||||
return $this->where('is_recommend', $recommend);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class EmployeeFilter extends ModelFilter
|
|||
public function search($key)
|
||||
{
|
||||
$condition = '%'.$key.'%';
|
||||
$this->where(fn($q) => $q->where('name', 'like', $condition)->orWhere('phone', 'like', $condition));
|
||||
$this->where(fn ($q) => $q->where('name', 'like', $condition)->orWhere('phone', 'like', $condition));
|
||||
}
|
||||
|
||||
public function name($key)
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Admin\Filters;
|
||||
|
||||
use EloquentFilter\ModelFilter;
|
||||
use App\Models\Keyword;
|
||||
use EloquentFilter\ModelFilter;
|
||||
|
||||
class KeywordFilter extends ModelFilter
|
||||
{
|
||||
|
|
@ -12,21 +12,22 @@ class KeywordFilter extends ModelFilter
|
|||
*/
|
||||
public function name($name)
|
||||
{
|
||||
return $this->where('name','like', '%'.$name.'%')
|
||||
->orWhere('key','like', '%'.$name.'%');
|
||||
return $this->where('name', 'like', '%'.$name.'%')
|
||||
->orWhere('key', 'like', '%'.$name.'%');
|
||||
}
|
||||
|
||||
public function parentName($parent_name)
|
||||
{
|
||||
if(request('has_owner', 1)){
|
||||
$this->where(function($q) use ($parent_name){
|
||||
$q->where('name','like', '%'.$parent_name.'%')
|
||||
->orWhere('key','like', '%'.$parent_name.'%');
|
||||
if (request('has_owner', 1)) {
|
||||
$this->where(function ($q) use ($parent_name) {
|
||||
$q->where('name', 'like', '%'.$parent_name.'%')
|
||||
->orWhere('key', 'like', '%'.$parent_name.'%');
|
||||
});
|
||||
}
|
||||
return $this->orWhere('path','like', '%-'.
|
||||
Keyword::where('name','like', '%'.$parent_name.'%')->orWhere('key','like', '%'.$parent_name.'%')->value('id')
|
||||
. '-%' ?? '');
|
||||
|
||||
return $this->orWhere('path', 'like', '%-'.
|
||||
Keyword::where('name', 'like', '%'.$parent_name.'%')->orWhere('key', 'like', '%'.$parent_name.'%')->value('id')
|
||||
.'-%' ?? '');
|
||||
}
|
||||
|
||||
public function parentKey($key)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class Menu
|
|||
public function all()
|
||||
{
|
||||
$menus = $this->userMenus()
|
||||
->push(...array_map(fn($item) => $this->formatItem($item), $this->menus))
|
||||
->push(...array_map(fn ($item) => $this->formatItem($item), $this->menus))
|
||||
->sortBy('order')
|
||||
->values()
|
||||
->toArray();
|
||||
|
|
@ -35,34 +35,35 @@ class Menu
|
|||
if ($item['parent_id'] == $parentId) {
|
||||
$idStr = "[{$item['id']}]";
|
||||
$_temp = [
|
||||
'name' => $parentName ? $parentName . '-' . $idStr : $idStr,
|
||||
'path' => $item['url'],
|
||||
'name' => $parentName ? $parentName.'-'.$idStr : $idStr,
|
||||
'path' => $item['url'],
|
||||
'component' => data_get($item, 'component') ?? 'amis',
|
||||
'is_home' => $item['is_home'],
|
||||
'is_full' => $item['is_full'] ?? 0,
|
||||
'is_link' => $item['url_type'] == Admin::adminMenuModel()::TYPE_LINK,
|
||||
'meta' => [
|
||||
'is_home' => $item['is_home'],
|
||||
'is_full' => $item['is_full'] ?? 0,
|
||||
'is_link' => $item['url_type'] == Admin::adminMenuModel()::TYPE_LINK,
|
||||
'meta' => [
|
||||
'title' => $item['title'],
|
||||
'icon' => $item['icon'] ?? '-',
|
||||
'hide' => $item['visible'] == 0,
|
||||
'icon' => $item['icon'] ?? '-',
|
||||
'hide' => $item['visible'] == 0,
|
||||
'order' => $item['order'],
|
||||
],
|
||||
];
|
||||
|
||||
$children = $this->list2Menu($list, (int)$item['id'], $_temp['name']);
|
||||
$children = $this->list2Menu($list, (int) $item['id'], $_temp['name']);
|
||||
|
||||
if (!empty($children)) {
|
||||
if (! empty($children)) {
|
||||
$_temp['component'] = 'amis';
|
||||
$_temp['children'] = $children;
|
||||
$_temp['children'] = $children;
|
||||
}
|
||||
|
||||
$data[] = $_temp;
|
||||
if (!in_array($_temp['path'], Admin::config('admin.route.without_extra_routes'))) {
|
||||
if (! in_array($_temp['path'], Admin::config('admin.route.without_extra_routes'))) {
|
||||
array_push($data, ...$this->generateRoute($_temp));
|
||||
}
|
||||
unset($list[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
@ -71,18 +72,18 @@ class Menu
|
|||
$url = $item['path'] ?? '';
|
||||
$url = preg_replace('/\?.*/', '', $url);
|
||||
|
||||
if (!$url || array_key_exists('children', $item)) {
|
||||
if (! $url || array_key_exists('children', $item)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$menu = fn($action, $path) => [
|
||||
'name' => $item['name'] . '-' . $action,
|
||||
'path' => $url . $path,
|
||||
$menu = fn ($action, $path) => [
|
||||
'name' => $item['name'].'-'.$action,
|
||||
'path' => $url.$path,
|
||||
'component' => 'amis',
|
||||
'meta' => [
|
||||
'hide' => true,
|
||||
'icon' => Arr::get($item, 'meta.icon'),
|
||||
'title' => Arr::get($item, 'meta.title') . ' - ' . __('admin.' . $action),
|
||||
'meta' => [
|
||||
'hide' => true,
|
||||
'icon' => Arr::get($item, 'meta.icon'),
|
||||
'title' => Arr::get($item, 'meta.title').' - '.__('admin.'.$action),
|
||||
],
|
||||
];
|
||||
|
||||
|
|
@ -103,15 +104,15 @@ class Menu
|
|||
private function formatItem($item)
|
||||
{
|
||||
return array_merge([
|
||||
'title' => '',
|
||||
'url' => '',
|
||||
'url_type' => 1,
|
||||
'icon' => '',
|
||||
'title' => '',
|
||||
'url' => '',
|
||||
'url_type' => 1,
|
||||
'icon' => '',
|
||||
'parent_id' => 0,
|
||||
'id' => 999,
|
||||
'is_home' => 0,
|
||||
'visible' => 1,
|
||||
'order' => 99,
|
||||
'id' => 999,
|
||||
'is_home' => 0,
|
||||
'visible' => 1,
|
||||
'order' => 99,
|
||||
], $item);
|
||||
}
|
||||
|
||||
|
|
@ -124,13 +125,13 @@ class Menu
|
|||
{
|
||||
$extraMenus = [
|
||||
[
|
||||
'name' => 'user_setting',
|
||||
'path' => '/user_setting',
|
||||
'name' => 'user_setting',
|
||||
'path' => '/user_setting',
|
||||
'component' => 'amis',
|
||||
'meta' => [
|
||||
'hide' => true,
|
||||
'title' => __('admin.user_setting'),
|
||||
'icon' => 'material-symbols:manage-accounts',
|
||||
'meta' => [
|
||||
'hide' => true,
|
||||
'title' => __('admin.user_setting'),
|
||||
'icon' => 'material-symbols:manage-accounts',
|
||||
'singleLayout' => 'basic',
|
||||
],
|
||||
],
|
||||
|
|
@ -152,39 +153,39 @@ class Menu
|
|||
{
|
||||
return [
|
||||
[
|
||||
'name' => 'dev_tools',
|
||||
'path' => '/dev_tools',
|
||||
'name' => 'dev_tools',
|
||||
'path' => '/dev_tools',
|
||||
'component' => 'amis',
|
||||
'meta' => [
|
||||
'meta' => [
|
||||
'title' => __('admin.developer'),
|
||||
'icon' => 'fluent:window-dev-tools-20-regular',
|
||||
'icon' => 'fluent:window-dev-tools-20-regular',
|
||||
],
|
||||
'children' => [
|
||||
'children' => [
|
||||
[
|
||||
'name' => 'dev_tools_extensions',
|
||||
'path' => '/dev_tools/extensions',
|
||||
'name' => 'dev_tools_extensions',
|
||||
'path' => '/dev_tools/extensions',
|
||||
'component' => 'amis',
|
||||
'meta' => [
|
||||
'meta' => [
|
||||
'title' => __('admin.extensions.menu'),
|
||||
'icon' => 'ion:extension-puzzle-outline',
|
||||
'icon' => 'ion:extension-puzzle-outline',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'dev_tools_code_generator',
|
||||
'path' => '/dev_tools/code_generator',
|
||||
'name' => 'dev_tools_code_generator',
|
||||
'path' => '/dev_tools/code_generator',
|
||||
'component' => 'amis',
|
||||
'meta' => [
|
||||
'meta' => [
|
||||
'title' => __('admin.code_generator'),
|
||||
'icon' => 'ic:baseline-code',
|
||||
'icon' => 'ic:baseline-code',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'dev_tools_editor',
|
||||
'path' => '/dev_tools/editor',
|
||||
'name' => 'dev_tools_editor',
|
||||
'path' => '/dev_tools/editor',
|
||||
'component' => 'editor',
|
||||
'meta' => [
|
||||
'meta' => [
|
||||
'title' => __('admin.visual_editor'),
|
||||
'icon' => 'mdi:monitor-edit',
|
||||
'icon' => 'mdi:monitor-edit',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class AdService extends BaseService
|
|||
public function store($data): bool
|
||||
{
|
||||
$columns = $this->getTableColumns();
|
||||
$model = $this->getModel();
|
||||
$model = $this->getModel();
|
||||
|
||||
$isEnable = Arr::get($data, 'is_enabled');
|
||||
$publishedAt = Arr::get($data, 'published_at');
|
||||
|
|
@ -32,14 +32,14 @@ class AdService extends BaseService
|
|||
$data['published_at'] = now();
|
||||
}
|
||||
|
||||
if(isset($data['resource'])){
|
||||
if (isset($data['resource'])) {
|
||||
$data['resource'] = $this->saveImage('resource', 'ads/resource')[0];
|
||||
}
|
||||
|
||||
//处理跳转配置
|
||||
$jumpType = Arr::get($data, 'jump_type');
|
||||
if($jumpType !== null){
|
||||
switch($jumpType){
|
||||
if ($jumpType !== null) {
|
||||
switch ($jumpType) {
|
||||
case Ad::TYPE_OFF:
|
||||
$data['jump_config'] = null;
|
||||
break;
|
||||
|
|
@ -47,16 +47,16 @@ class AdService extends BaseService
|
|||
$data['jump_config'] = Arr::only($data['jump_config'], 'web_link');
|
||||
break;
|
||||
case Ad::TYPE_APP:
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], 'app_link');;
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], 'app_link');
|
||||
break;
|
||||
case Ad::TYPE_MINI:
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], ['mini_id', 'mini_link']);;
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], ['mini_id', 'mini_link']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
if (!in_array($k, $columns)) {
|
||||
if (! in_array($k, $columns)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ class AdService extends BaseService
|
|||
public function update($primaryKey, $data): bool
|
||||
{
|
||||
$columns = $this->getTableColumns();
|
||||
$model = $this->query()->whereKey($primaryKey)->first();
|
||||
$model = $this->query()->whereKey($primaryKey)->first();
|
||||
|
||||
$isEnable = Arr::get($data, 'is_enable');
|
||||
$publishedAt = Arr::get($data, 'published_at');
|
||||
|
|
@ -78,14 +78,14 @@ class AdService extends BaseService
|
|||
$data['published_at'] = now();
|
||||
}
|
||||
|
||||
if(isset($data['resource'])){
|
||||
if (isset($data['resource'])) {
|
||||
$data['resource'] = $this->saveImage('resource', 'ads/resource')[0];
|
||||
}
|
||||
|
||||
//处理跳转配置
|
||||
$jumpType = Arr::get($data, 'jump_type');
|
||||
if($jumpType !== null){
|
||||
switch($jumpType){
|
||||
if ($jumpType !== null) {
|
||||
switch ($jumpType) {
|
||||
case Ad::TYPE_OFF:
|
||||
$data['jump_config'] = null;
|
||||
break;
|
||||
|
|
@ -93,16 +93,16 @@ class AdService extends BaseService
|
|||
$data['jump_config'] = Arr::only($data['jump_config'], 'web_link');
|
||||
break;
|
||||
case Ad::TYPE_APP:
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], 'app_link');;
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], 'app_link');
|
||||
break;
|
||||
case Ad::TYPE_MINI:
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], ['mini_id', 'mini_link']);;
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], ['mini_id', 'mini_link']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
if (!in_array($k, $columns)) {
|
||||
if (! in_array($k, $columns)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
namespace App\Admin\Services;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
||||
|
||||
/**
|
||||
* @method AdminUser getModel()
|
||||
|
|
@ -37,11 +37,11 @@ class AdminUserService extends BaseService
|
|||
return $this->setError(__('admin.admin_user.username_already_exists'));
|
||||
}
|
||||
|
||||
if (!data_get($data, 'password')) {
|
||||
if (! data_get($data, 'password')) {
|
||||
return $this->setError(__('admin.required', ['attribute' => __('admin.password')]));
|
||||
}
|
||||
|
||||
if (!$this->passwordHandler($data)) {
|
||||
if (! $this->passwordHandler($data)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ class AdminUserService extends BaseService
|
|||
return $this->setError(__('admin.admin_user.username_already_exists'));
|
||||
}
|
||||
|
||||
if (!$this->passwordHandler($data)) {
|
||||
if (! $this->passwordHandler($data)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -73,13 +73,13 @@ class AdminUserService extends BaseService
|
|||
{
|
||||
return $this->query()
|
||||
->where('username', $username)
|
||||
->when($id, fn($query) => $query->where('id', '<>', $id))
|
||||
->when($id, fn ($query) => $query->where('id', '<>', $id))
|
||||
->exists();
|
||||
}
|
||||
|
||||
public function updateUserSetting($primaryKey, $data): bool
|
||||
{
|
||||
if (!$this->passwordHandler($data, $primaryKey)) {
|
||||
if (! $this->passwordHandler($data, $primaryKey)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -96,13 +96,13 @@ class AdminUserService extends BaseService
|
|||
}
|
||||
|
||||
if ($id) {
|
||||
if (!Arr::get($data, 'old_password')) {
|
||||
if (! Arr::get($data, 'old_password')) {
|
||||
return $this->setError(__('admin.admin_user.old_password_required'));
|
||||
}
|
||||
|
||||
$oldPassword = $this->query()->where('id', $id)->value('password');
|
||||
|
||||
if (!Hash::check($data['old_password'], $oldPassword)) {
|
||||
if (! Hash::check($data['old_password'], $oldPassword)) {
|
||||
return $this->setError(__('admin.admin_user.old_password_error'));
|
||||
}
|
||||
}
|
||||
|
|
@ -136,19 +136,12 @@ class AdminUserService extends BaseService
|
|||
return compact('items', 'total');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param array $columns
|
||||
* @param AdminUser $model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function saveData($data, array $columns, AdminUser $model): bool
|
||||
{
|
||||
$roles = Arr::pull($data, 'roles');
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
if (!in_array($k, $columns)) {
|
||||
if (! in_array($k, $columns)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class ArticleService extends BaseService
|
|||
public function store($data): bool
|
||||
{
|
||||
$columns = $this->getTableColumns();
|
||||
$model = $this->getModel();
|
||||
$model = $this->getModel();
|
||||
|
||||
$isEnable = Arr::get($data, 'is_enabled');
|
||||
$publishedAt = Arr::get($data, 'published_at');
|
||||
|
|
@ -36,7 +36,7 @@ class ArticleService extends BaseService
|
|||
$data['appendixes'] = $this->saveFile('appendixes', 'articles/appendixes');
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
if (!in_array($k, $columns)) {
|
||||
if (! in_array($k, $columns)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ class ArticleService extends BaseService
|
|||
public function update($primaryKey, $data): bool
|
||||
{
|
||||
$columns = $this->getTableColumns();
|
||||
$model = $this->query()->whereKey($primaryKey)->first();
|
||||
$model = $this->query()->whereKey($primaryKey)->first();
|
||||
|
||||
$isEnable = Arr::get($data, 'is_enable');
|
||||
$publishedAt = Arr::get($data, 'published_at');
|
||||
|
|
@ -58,16 +58,16 @@ class ArticleService extends BaseService
|
|||
$data['published_at'] = now();
|
||||
}
|
||||
|
||||
if(isset($data['cover'])){
|
||||
if (isset($data['cover'])) {
|
||||
$data['cover'] = $this->saveImage('cover', 'articles/cover')[0] ?? '';
|
||||
}
|
||||
|
||||
if(isset($data['appendixes'])){
|
||||
if (isset($data['appendixes'])) {
|
||||
$data['appendixes'] = $this->saveFile('appendixes', 'articles/appendixes');
|
||||
}
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
if (!in_array($k, $columns)) {
|
||||
if (! in_array($k, $columns)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ class BaseService extends AdminService
|
|||
{
|
||||
$list = $this->query()->orderByDesc('sort')->get();
|
||||
$minNum = $list->min('parent_id');
|
||||
|
||||
return array2tree($list->toArray(), $minNum);
|
||||
}
|
||||
|
||||
|
|
@ -34,7 +35,7 @@ class BaseService extends AdminService
|
|||
$filter = $this->getModelFilter();
|
||||
|
||||
$query = $this->query();
|
||||
if($this->withRelationships){
|
||||
if ($this->withRelationships) {
|
||||
$query->with($this->withRelationships);
|
||||
}
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ class BaseService extends AdminService
|
|||
$query->filter(request()->input(), $filter);
|
||||
}
|
||||
|
||||
if($this->modelSortAble){
|
||||
if ($this->modelSortAble) {
|
||||
$query->sort();
|
||||
}
|
||||
|
||||
|
|
@ -63,6 +64,7 @@ class BaseService extends AdminService
|
|||
$validate = $this->validate($data);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -78,6 +80,7 @@ class BaseService extends AdminService
|
|||
$validate = $this->validate($data, $model);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -90,16 +93,18 @@ class BaseService extends AdminService
|
|||
$result = $this->preDelete($id);
|
||||
if ($result !== true) {
|
||||
$this->setError($result);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->query()->whereIn($this->primaryKey(), $id)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理表单数据
|
||||
*
|
||||
* @param array $data
|
||||
* @param Model $model 空 : 添加, 非空: 修改
|
||||
* @param array $data
|
||||
* @param Model $model 空 : 添加, 非空: 修改
|
||||
* @return array
|
||||
*/
|
||||
public function resloveData($data, $model = null)
|
||||
|
|
@ -110,8 +115,8 @@ class BaseService extends AdminService
|
|||
/**
|
||||
* 表单验证
|
||||
*
|
||||
* @param array $data
|
||||
* @param Model $model 空: 添加, 非空: 修改
|
||||
* @param array $data
|
||||
* @param Model $model 空: 添加, 非空: 修改
|
||||
* @return mixed true: 验证通过, string: 错误提示
|
||||
*/
|
||||
public function validate($data, $model = null)
|
||||
|
|
@ -135,7 +140,7 @@ class BaseService extends AdminService
|
|||
/**
|
||||
* 删除的前置方法
|
||||
*
|
||||
* @param array $ids 主键id
|
||||
* @param array $ids 主键id
|
||||
* @return mixed true: 继续后续操作, string: 中断操作, 返回错误提示
|
||||
*/
|
||||
public function preDelete(array $ids)
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ namespace App\Admin\Services;
|
|||
|
||||
use App\Admin\Filters\EmployeeFilter;
|
||||
use App\Models\Employee;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Slowlyo\OwlAdmin\Services\AdminUserService;
|
||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
||||
use Slowlyo\OwlAdmin\Services\AdminUserService;
|
||||
|
||||
class EmployeeService extends BaseService
|
||||
{
|
||||
|
|
@ -26,6 +26,7 @@ class EmployeeService extends BaseService
|
|||
$validate = $this->validate($data);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -45,6 +46,7 @@ class EmployeeService extends BaseService
|
|||
$validate = $this->validate($data, $model);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +62,7 @@ class EmployeeService extends BaseService
|
|||
$model = $this->getModel();
|
||||
|
||||
$hidden = collect([$model->getCreatedAtColumn(), $model->getUpdatedAtColumn()])
|
||||
->filter(fn($item) => $item !== null)
|
||||
->filter(fn ($item) => $item !== null)
|
||||
->toArray();
|
||||
|
||||
return $this->query()->with(['adminUser', 'jobs'])->find($id)->makeHidden($hidden);
|
||||
|
|
@ -73,28 +75,31 @@ class EmployeeService extends BaseService
|
|||
if ($model) {
|
||||
// 修改管理员信息
|
||||
if (Arr::hasAny($data, ['username', 'password', 'confirm_password'])) {
|
||||
if (!$adminUserService->update($model->admin_user_id, Arr::only($data, ['username', 'password', 'confirm_password']))) {
|
||||
if (! $adminUserService->update($model->admin_user_id, Arr::only($data, ['username', 'password', 'confirm_password']))) {
|
||||
$this->setError($adminUserService->getError());
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 添加管理员信息
|
||||
if (!$adminUserService->store(Arr::only($data, ['username', 'password', 'confirm_password']))) {
|
||||
if (! $adminUserService->store(Arr::only($data, ['username', 'password', 'confirm_password']))) {
|
||||
$this->setError($adminUserService->getError());
|
||||
|
||||
return false;
|
||||
}
|
||||
$adminUser = AdminUser::where('username', $data['username'])->first();
|
||||
$data['admin_user_id'] = $adminUser->id;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理职位关联
|
||||
*
|
||||
* @param Employee $model
|
||||
* @param array $jobs(字典表 key 组成的数组)
|
||||
* @param Employee $model
|
||||
* @param array $jobs(字典表 key 组成的数组)
|
||||
*/
|
||||
public function resloveJob($model, $jobs)
|
||||
{
|
||||
|
|
@ -107,6 +112,7 @@ class EmployeeService extends BaseService
|
|||
$adminUserIds = Employee::whereIn('id', $ids)->pluck('admin_user_id')->implode(',');
|
||||
$adminUserService = AdminUserService::make();
|
||||
$adminUserService->delete($adminUserIds);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -118,12 +124,13 @@ class EmployeeService extends BaseService
|
|||
];
|
||||
$updateRules = [];
|
||||
$validator = Validator::make($data, $model ? $updateRules : $createRules, [
|
||||
'name.required' => __('employee.name') . '必填',
|
||||
'phone.required' => __('employee.phone') . '必填',
|
||||
'name.required' => __('employee.name').'必填',
|
||||
'phone.required' => __('employee.phone').'必填',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return $validator->errors()->first();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,13 +13,15 @@ use Illuminate\Support\Arr;
|
|||
class KeywordService extends BaseService
|
||||
{
|
||||
protected string $modelName = Keyword::class;
|
||||
|
||||
protected string $modelFilterName = KeywordFilter::class;
|
||||
|
||||
public function getTree()
|
||||
{
|
||||
$list = $this->query()->filter(request()->all(), $this->modelFilterName)->get();
|
||||
$minNum = $list->min('parent_id');
|
||||
return !$list->isEmpty() ? array2tree($list->toArray(), $minNum) :[];
|
||||
|
||||
return ! $list->isEmpty() ? array2tree($list->toArray(), $minNum) : [];
|
||||
}
|
||||
|
||||
public function parentIsChild($id, $pid): bool
|
||||
|
|
@ -53,7 +55,7 @@ class KeywordService extends BaseService
|
|||
$model = $this->getModel();
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
if (!in_array($k, $columns)) {
|
||||
if (! in_array($k, $columns)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -75,6 +77,7 @@ class KeywordService extends BaseService
|
|||
if ($pid != 0) {
|
||||
if ($this->parentIsChild($primaryKey, $pid)) {
|
||||
$this->setError('父级不允许设置为当前子权限');
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -82,7 +85,7 @@ class KeywordService extends BaseService
|
|||
$model = $this->query()->whereKey($primaryKey)->first();
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
if (!in_array($k, $columns)) {
|
||||
if (! in_array($k, $columns)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -94,10 +97,11 @@ class KeywordService extends BaseService
|
|||
|
||||
public function hasRepeated($data, $id = 0): bool
|
||||
{
|
||||
$query = $this->query()->when($id, fn($query) => $query->where('id', '<>', $id));
|
||||
$query = $this->query()->when($id, fn ($query) => $query->where('id', '<>', $id));
|
||||
|
||||
if ((clone $query)->where('key', $data['key'])->exists()) {
|
||||
$this->setError('KEY重复');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +111,7 @@ class KeywordService extends BaseService
|
|||
public function delete(string $ids): mixed
|
||||
{
|
||||
$ids = explode(',', $ids);
|
||||
if(count($ids) == 1){
|
||||
if (count($ids) == 1) {
|
||||
$this->query()->where('path', 'like', '%-'.$ids[0].'-%')->delete();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
namespace App\Admin\Services;
|
||||
|
||||
use App\Admin\Filters\StoreFilter;
|
||||
use App\Models\Store;
|
||||
use App\Enums\StoreRole;
|
||||
use App\Models\Store;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
|
|
@ -23,6 +23,7 @@ class StoreService extends BaseService
|
|||
$validate = $this->validate($data);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +42,7 @@ class StoreService extends BaseService
|
|||
$validate = $this->validate($data, $model);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -59,6 +61,7 @@ class StoreService extends BaseService
|
|||
$data['lon'] = data_get($data['location'], 'lng');
|
||||
$data['lat'] = data_get($data['location'], 'lat');
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
@ -75,7 +78,7 @@ class StoreService extends BaseService
|
|||
'lat' => ['required'],
|
||||
];
|
||||
$updateRules = [
|
||||
'master_id' => [Rule::unique($model, 'master_id')]
|
||||
'master_id' => [Rule::unique($model, 'master_id')],
|
||||
];
|
||||
$validator = Validator::make($data, $model ? $updateRules : $createRules, [
|
||||
'master_id.unique' => '已经是店长了',
|
||||
|
|
@ -83,6 +86,7 @@ class StoreService extends BaseService
|
|||
if ($validator->fails()) {
|
||||
return $validator->errors()->first();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,4 +6,4 @@ use Slowlyo\OwlAdmin\Admin;
|
|||
// '.cxd-Panel-heading { border-width: 0; background: #4080ffc7 !important; }',
|
||||
// // '.cxd-Panel {box-shadow: none; }',
|
||||
// '.cxd-Panel-title { color:white;font-size: 16px; }'
|
||||
// ]);
|
||||
// ]);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Casts;
|
||||
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Storage as StorageFacades;
|
||||
|
||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||
use Illuminate\Support\Facades\Storage as StorageFacades;
|
||||
use Illuminate\Support\Str;
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
|
||||
/**
|
||||
* 转换文件存储路径
|
||||
*
|
||||
*
|
||||
* get: 返回全路径
|
||||
* set: 原样保存
|
||||
*/
|
||||
|
|
@ -28,7 +28,7 @@ class Storage implements CastsAttributes
|
|||
{
|
||||
return $value ? (Str::startsWith($value, ['http://', 'https://']) ? $value : StorageFacades::disk(Admin::config('admin.upload.disk'))->url($value)) : '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepare the given value for storage.
|
||||
*
|
||||
|
|
@ -42,4 +42,4 @@ class Storage implements CastsAttributes
|
|||
{
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ enum BusinessStatus: int
|
|||
foreach (self::map() as $key => $value) {
|
||||
array_push($list, ['label' => $value, 'value' => $key]);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ enum EmployeeStatus: int
|
|||
foreach (self::map() as $key => $value) {
|
||||
array_push($list, ['label' => $value, 'value' => $key]);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ enum StoreRole: int
|
|||
foreach (self::map() as $key => $value) {
|
||||
array_push($list, ['label' => $value, 'value' => $key]);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,20 +2,22 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use EloquentFilter\Filterable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use EloquentFilter\Filterable;
|
||||
use App\Casts\Storage;
|
||||
|
||||
class Ad extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use Filterable;
|
||||
use HasFactory;
|
||||
|
||||
public const TYPE_OFF = 0; //无跳转
|
||||
|
||||
public const TYPE_WEB = 1; //网页跳转
|
||||
|
||||
public const TYPE_APP = 2; //应用跳转
|
||||
public const TYPE_MINI = 3;//小程序跳转
|
||||
|
||||
public const TYPE_MINI = 3; //小程序跳转
|
||||
|
||||
protected function serializeDate(\DateTimeInterface $date)
|
||||
{
|
||||
|
|
@ -41,7 +43,7 @@ class Ad extends Model
|
|||
'jump_config',
|
||||
];
|
||||
|
||||
public static function jumpTypeMap() :array
|
||||
public static function jumpTypeMap(): array
|
||||
{
|
||||
return [
|
||||
self::TYPE_WEB => '网页跳转',
|
||||
|
|
@ -58,7 +60,7 @@ class Ad extends Model
|
|||
self::TYPE_WEB => "<span class='label label-info'>网页跳转</span>",
|
||||
self::TYPE_APP => "<span class='label label-warning'>应用跳转</span>",
|
||||
self::TYPE_MINI => "<span class='label label-green'>小程序跳转</span>",
|
||||
'*'=>'其他:${jump_type}'
|
||||
'*' => '其他:${jump_type}',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -68,18 +70,19 @@ class Ad extends Model
|
|||
self::TYPE_IN => "<span class='label label-info'>入住缴费</span>",
|
||||
self::TYPE_CONTINUE => "<span class='label label-warning'>续住缴费</span>",
|
||||
self::TYPE_EXIT => "<span class='label label-danger'>离开结算</span>",
|
||||
'*'=>'其他:${live_in}'
|
||||
'*' => '其他:${live_in}',
|
||||
];
|
||||
}
|
||||
|
||||
public function scopeShow(){
|
||||
public function scopeShow()
|
||||
{
|
||||
$q->where('is_enable', true)->where('published_at', '>=', now());
|
||||
}
|
||||
|
||||
public function scopeSort($q)
|
||||
{
|
||||
$q->orderBy('sort', 'asc')
|
||||
->orderBy('published_at', 'desc')
|
||||
->orderBy('created_at', 'desc');
|
||||
->orderBy('published_at', 'desc')
|
||||
->orderBy('created_at', 'desc');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class AdminUser extends Model
|
|||
}
|
||||
|
||||
$parent = $allMenus->get($parent->parent_id);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
unset($allMenus, $roleMenus);
|
||||
|
|
|
|||
|
|
@ -2,16 +2,15 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use EloquentFilter\Filterable;
|
||||
use App\Casts\Storage;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Article extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use Filterable;
|
||||
use HasFactory;
|
||||
|
||||
protected function serializeDate(\DateTimeInterface $date)
|
||||
{
|
||||
|
|
@ -42,7 +41,8 @@ class Article extends Model
|
|||
'appendixes',
|
||||
];
|
||||
|
||||
public function scopeShow(){
|
||||
public function scopeShow()
|
||||
{
|
||||
$q->where('is_enable', true)->where('published_at', '>=', now());
|
||||
}
|
||||
|
||||
|
|
@ -54,10 +54,10 @@ class Article extends Model
|
|||
->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
protected function tags():Attribute
|
||||
protected function tags(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn($value) => $this->t_ids ? explode(',', $this->t_ids) : [],
|
||||
get: fn ($value) => $this->t_ids ? explode(',', $this->t_ids) : [],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Enums\EmployeeStatus;
|
||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use EloquentFilter\Filterable;
|
||||
use App\Traits\HasDateTimeFormatter;
|
||||
use EloquentFilter\Filterable;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
||||
|
||||
/**
|
||||
* 员工
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ use Illuminate\Support\Str;
|
|||
|
||||
class Keyword extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use Filterable;
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['name', 'key', 'value', 'parent_id', 'parent_key', 'path', 'sort', 'lv'];
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ class Keyword extends Model
|
|||
'lv' => 1,
|
||||
]);
|
||||
|
||||
if((string) $keyword->key === ''){
|
||||
if ((string) $keyword->key === '') {
|
||||
$keyword->key = Str::random(16);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -43,8 +43,8 @@ class Keyword extends Model
|
|||
'lv' => $parent->lv + 1,
|
||||
]);
|
||||
|
||||
if((string) $keyword->key === ''){
|
||||
$keyword->key = $parent->key . '_' . ($parent->children()->count() + 1);
|
||||
if ((string) $keyword->key === '') {
|
||||
$keyword->key = $parent->key.'_'.($parent->children()->count() + 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -62,17 +62,18 @@ class Keyword extends Model
|
|||
|
||||
public function scopeAllChildrenOfKey($q, $parentKey)
|
||||
{
|
||||
$q->where('path','like', '%-'.
|
||||
$q->where('path', 'like', '%-'.
|
||||
static::where('key', $parentKey)->value('id')
|
||||
. '-%' ?? '');
|
||||
.'-%' ?? '');
|
||||
}
|
||||
|
||||
public static function tagsMap(String $key)
|
||||
public static function tagsMap(string $key)
|
||||
{
|
||||
$mapArr = [];
|
||||
self::query()->where('parent_key', $key)->get()->map(function($item) use (&$mapArr){
|
||||
self::query()->where('parent_key', $key)->get()->map(function ($item) use (&$mapArr) {
|
||||
$mapArr[$item->id] = Components::make()->keywordsTag($item->name, $item->value);
|
||||
});
|
||||
|
||||
return $mapArr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Enums\BusinessStatus;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use EloquentFilter\Filterable;
|
||||
use App\Traits\HasDateTimeFormatter;
|
||||
use EloquentFilter\Filterable;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* 门店
|
||||
|
|
|
|||
|
|
@ -35,10 +35,6 @@ class QueryLoggerServiceProvider extends ServiceProvider
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Database\Events\QueryExecuted $query
|
||||
* @return string
|
||||
*/
|
||||
protected function prepareSql(QueryExecuted $query): string
|
||||
{
|
||||
$sql = str_replace(['%', '?'], ['%%', '%s'], $query->sql);
|
||||
|
|
@ -54,7 +50,6 @@ class QueryLoggerServiceProvider extends ServiceProvider
|
|||
|
||||
/**
|
||||
* @param float $milliseconds
|
||||
* @return string
|
||||
*/
|
||||
protected function formatDuration($milliseconds): string
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,23 +2,16 @@
|
|||
|
||||
namespace App\Traits;
|
||||
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
use Slowlyo\OwlAdmin\Renderers\Drawer;
|
||||
use Slowlyo\OwlAdmin\Renderers\Dialog;
|
||||
use Slowlyo\OwlAdmin\Renderers\DrawerAction;
|
||||
use Slowlyo\OwlAdmin\Renderers\DialogAction;
|
||||
use Slowlyo\OwlAdmin\Renderers\Drawer;
|
||||
use Slowlyo\OwlAdmin\Renderers\DrawerAction;
|
||||
use Slowlyo\OwlAdmin\Renderers\LinkAction;
|
||||
|
||||
trait CustomActionTrait
|
||||
{
|
||||
/**
|
||||
/**
|
||||
* 新增按钮
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $size
|
||||
* @param string $width
|
||||
*
|
||||
* @return DialogAction|DrawerAction|LinkAction
|
||||
*/
|
||||
protected function createTypeButton(string $type = '', string $size = '', string $width = ''): DialogAction|DrawerAction|LinkAction
|
||||
{
|
||||
|
|
@ -27,9 +20,9 @@ trait CustomActionTrait
|
|||
$form = $this->form(false)->api($this->getStorePath())->onEvent([]);
|
||||
|
||||
$drawer = Drawer::make()->title(__('admin.create'))->body($form)->closeOnOutside();
|
||||
if($width){
|
||||
if ($width) {
|
||||
$drawer->width($width);
|
||||
}else{
|
||||
} else {
|
||||
$drawer->size($size);
|
||||
}
|
||||
$button = DrawerAction::make()->drawer($drawer);
|
||||
|
|
@ -51,28 +44,22 @@ trait CustomActionTrait
|
|||
|
||||
/**
|
||||
* 行编辑按钮
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $size
|
||||
* @param string $width
|
||||
*
|
||||
* @return DialogAction|DrawerAction|LinkAction
|
||||
*/
|
||||
protected function rowEditTypeButton(string $type = '', string $size = '', string $width = ''): DialogAction|DrawerAction|LinkAction
|
||||
{
|
||||
switch ($type) {
|
||||
case 'drawer':
|
||||
$form = $this->form(true)
|
||||
->api($this->getUpdatePath())
|
||||
->initApi($this->getEditGetDataPath())
|
||||
->redirect('')
|
||||
->onEvent([]);
|
||||
->api($this->getUpdatePath())
|
||||
->initApi($this->getEditGetDataPath())
|
||||
->redirect('')
|
||||
->onEvent([]);
|
||||
|
||||
$drawer = Drawer::make()->title(__('admin.edit'))->body($form)->closeOnOutside();
|
||||
|
||||
if($width){
|
||||
if ($width) {
|
||||
$drawer->width($width);
|
||||
}else{
|
||||
} else {
|
||||
$drawer->size($size);
|
||||
}
|
||||
|
||||
|
|
@ -99,12 +86,6 @@ trait CustomActionTrait
|
|||
|
||||
/**
|
||||
* 行详情按钮
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $size
|
||||
* @param string $width
|
||||
*
|
||||
* @return DialogAction|DrawerAction|LinkAction
|
||||
*/
|
||||
protected function rowShowTypeButton(string $type = '', string $size = '', string $width = ''): DialogAction|DrawerAction|LinkAction
|
||||
{
|
||||
|
|
@ -112,15 +93,15 @@ trait CustomActionTrait
|
|||
case 'drawer':
|
||||
$drawer = Drawer::make()->title(__('admin.show'))->name('detail_info')->body($this->detail('$id'))->closeOnOutside();
|
||||
|
||||
if($width){
|
||||
if ($width) {
|
||||
$drawer->width($width);
|
||||
}else{
|
||||
} else {
|
||||
$drawer->size($size);
|
||||
}
|
||||
//补充详情操作按钮扩展
|
||||
try{
|
||||
try {
|
||||
$actions = $this->detailActions();
|
||||
}catch(\BadMethodCallException $e){
|
||||
} catch (\BadMethodCallException $e) {
|
||||
$actions = [];
|
||||
}
|
||||
$drawer->actions($actions);
|
||||
|
|
@ -130,9 +111,9 @@ trait CustomActionTrait
|
|||
case 'dialog':
|
||||
//补充详情操作按钮扩展
|
||||
$dialog = Dialog::make()->title(__('admin.show'))->name('detail_info')->body($this->detail('$id'))->size($size);
|
||||
try{
|
||||
try {
|
||||
$actions = $this->detailActions();
|
||||
}catch(\BadMethodCallException $e){
|
||||
} catch (\BadMethodCallException $e) {
|
||||
$actions = [];
|
||||
}
|
||||
$dialog->actions($actions);
|
||||
|
|
@ -145,4 +126,4 @@ trait CustomActionTrait
|
|||
|
||||
return $button->label(__('admin.show'))->icon('fa-regular fa-eye')->level('link');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace App\Traits;
|
||||
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
|
||||
trait UploadTrait
|
||||
{
|
||||
|
|
@ -25,17 +25,17 @@ trait UploadTrait
|
|||
public function uploadRich()
|
||||
{
|
||||
$fromWangEditor = false;
|
||||
$file = request()->file('file');
|
||||
$file = request()->file('file');
|
||||
|
||||
if (!$file) {
|
||||
if (! $file) {
|
||||
$fromWangEditor = true;
|
||||
$file = request()->file('wangeditor-uploaded-image');
|
||||
if (!$file) {
|
||||
$file = request()->file('wangeditor-uploaded-image');
|
||||
if (! $file) {
|
||||
$file = request()->file('wangeditor-uploaded-video');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$file) {
|
||||
if (! $file) {
|
||||
return $this->response()->additional(['errno' => 1])->fail(__('admin.upload_file_error'));
|
||||
}
|
||||
|
||||
|
|
@ -57,71 +57,72 @@ trait UploadTrait
|
|||
{
|
||||
$file = request()->file('file');
|
||||
|
||||
if (!$file) {
|
||||
if (! $file) {
|
||||
return $this->response()->fail(__('admin.upload_file_error'));
|
||||
}
|
||||
|
||||
$path = $file->store(Admin::config('admin.upload.tem_directory.' . $type).'/'.date('Y-m-d'), Admin::config('admin.upload.disk'));
|
||||
$path = $file->store(Admin::config('admin.upload.tem_directory.'.$type).'/'.date('Y-m-d'), Admin::config('admin.upload.disk'));
|
||||
|
||||
return $this->response()->success(['value' => $path]);
|
||||
}
|
||||
|
||||
public function saveImage($field = 'image', $path)
|
||||
public function saveImage($field, $path)
|
||||
{
|
||||
return $this->saveFile($field, $path);
|
||||
return $this->saveFile($field, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 表单提交时,转存实际目录,并保留上传时文件名称;文件保存全路径
|
||||
*/
|
||||
public function saveFile($field = 'file', $path)
|
||||
public function saveFile($field, $path)
|
||||
{
|
||||
$file = request()->file($field);
|
||||
|
||||
if (!$file) {
|
||||
$file = request()->get($field);
|
||||
if (! $file) {
|
||||
$file = request()->get($field);
|
||||
}
|
||||
|
||||
$fileArr = [];
|
||||
//判断是否多个文件;
|
||||
if(is_string($file) || isset($file['id'])){
|
||||
if (is_string($file) || isset($file['id'])) {
|
||||
$files = [$file];
|
||||
}else{
|
||||
} else {
|
||||
$files = $file;
|
||||
}
|
||||
|
||||
if($files){
|
||||
foreach($files as $file){
|
||||
if(is_array($file) && isset($file['state'])){
|
||||
switch($file['state']){
|
||||
if ($files) {
|
||||
foreach ($files as $file) {
|
||||
if (is_array($file) && isset($file['state'])) {
|
||||
switch ($file['state']) {
|
||||
case 'init':
|
||||
if(strpos($file['value'], 'temporary') !== false){
|
||||
if (strpos($file['value'], 'temporary') !== false) {
|
||||
$filePath = $path.'/'.$file['name'];
|
||||
Storage::disk(Admin::config('admin.upload.disk'))->move($file['value'], $filePath);
|
||||
Storage::disk(Admin::config('admin.upload.disk'))->move($file['value'], $filePath);
|
||||
$fileArr[] = Storage::disk(Admin::config('admin.upload.disk'))->url($filePath);
|
||||
}else{
|
||||
} else {
|
||||
$fileArr[] = $file['value'];
|
||||
}
|
||||
break;
|
||||
case 'uploaded':
|
||||
if(isset($file['name'])){
|
||||
if (isset($file['name'])) {
|
||||
$filePath = $path.'/'.$file['name'];
|
||||
if(Str::startsWith($file['value'], ['http://', 'https://'])){
|
||||
if (Str::startsWith($file['value'], ['http://', 'https://'])) {
|
||||
$fileUrl = parse_url($file['value']);
|
||||
$fileValue = ltrim($fileUrl['path'], '/');
|
||||
}else{
|
||||
} else {
|
||||
$fileValue = $file['value'];
|
||||
}
|
||||
Storage::disk(Admin::config('admin.upload.disk'))->move($file['value'], $filePath);
|
||||
Storage::disk(Admin::config('admin.upload.disk'))->move($file['value'], $filePath);
|
||||
$fileArr[] = Storage::disk(Admin::config('admin.upload.disk'))->url($filePath);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$fileArr[] = $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $fileArr;
|
||||
}
|
||||
|
||||
|
|
@ -135,8 +136,8 @@ trait UploadTrait
|
|||
$uploadId = md5(time().$fileName);
|
||||
|
||||
//创建临时文件夹
|
||||
if ( Storage::disk(Admin::config('admin.upload.disk'))->exists(Admin::config('admin.upload.tem_directory.' . $type).'/'.$uploadId) === false ) {
|
||||
if ( Storage::disk(Admin::config('admin.upload.disk'))->makeDirectory(Admin::config('admin.upload.tem_directory.' . $type).'/'.$uploadId) === false ) {
|
||||
if (Storage::disk(Admin::config('admin.upload.disk'))->exists(Admin::config('admin.upload.tem_directory.'.$type).'/'.$uploadId) === false) {
|
||||
if (Storage::disk(Admin::config('admin.upload.disk'))->makeDirectory(Admin::config('admin.upload.tem_directory.'.$type).'/'.$uploadId) === false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -159,14 +160,15 @@ trait UploadTrait
|
|||
$fileName = $file->getClientOriginalName();
|
||||
|
||||
//判断该分片是否已存在,
|
||||
$dirPath = Admin::config('admin.upload.tem_directory.' . $type).'/'.$uploadId;
|
||||
if(Storage::disk(Admin::config('admin.upload.disk'))->exists($dirPath . '/'.$fileName.'_'.$partNumber)){
|
||||
$dirPath = Admin::config('admin.upload.tem_directory.'.$type).'/'.$uploadId;
|
||||
if (Storage::disk(Admin::config('admin.upload.disk'))->exists($dirPath.'/'.$fileName.'_'.$partNumber)) {
|
||||
return $this->response()->fail(__('admin.upload_file_error'));
|
||||
}else{
|
||||
} else {
|
||||
//验证分片大小-todo
|
||||
$path = $file->storeAs($dirPath, $fileName.'_'.$partNumber, Admin::config('admin.upload.disk'));
|
||||
$realPath = Storage::disk(Admin::config('admin.upload.disk'))->url($path);
|
||||
$eTag = md5_file($realPath);
|
||||
|
||||
return $this->response()->success(['eTag' => $eTag]);
|
||||
}
|
||||
}
|
||||
|
|
@ -182,18 +184,18 @@ trait UploadTrait
|
|||
$uploadId = request()->get('uploadId', '');
|
||||
$partList = request()->get('partList', []);
|
||||
|
||||
$basePath = Admin::config('admin.upload.tem_directory.' . $type).'/'.$uploadId;
|
||||
$basePath = Admin::config('admin.upload.tem_directory.'.$type).'/'.$uploadId;
|
||||
$realPath = 'chunk/'.$fileName;
|
||||
|
||||
//获取分片列表中序号,查看分片是否都完成上传
|
||||
$partNumberList = Arr::pluck($partList, 'partNumber');
|
||||
|
||||
if(max($partNumberList) === count($partNumberList)){
|
||||
|
||||
if (max($partNumberList) === count($partNumberList)) {
|
||||
//判断是否已存在同名文件,进行删除
|
||||
if(Storage::disk(Admin::config('admin.upload.disk'))->exists($realPath)){
|
||||
if (Storage::disk(Admin::config('admin.upload.disk'))->exists($realPath)) {
|
||||
$realPath = 'chunk/(1)'.$fileName;
|
||||
}
|
||||
for($i = 1; $i<=count($partNumberList); $i++){
|
||||
for ($i = 1; $i <= count($partNumberList); $i++) {
|
||||
$_file = Storage::disk(Admin::config('admin.upload.disk'))->get($basePath.'/'.$fileName.'_'.$i);
|
||||
Storage::disk(Admin::config('admin.upload.disk'))->append($realPath, $_file, null);
|
||||
}
|
||||
|
|
@ -202,9 +204,9 @@ trait UploadTrait
|
|||
|
||||
$value = Storage::disk(Admin::config('admin.upload.disk'))->url($realPath);
|
||||
|
||||
return $this->response()->success(['value'=>$value]);
|
||||
}else{
|
||||
return $this->response()->success(['value' => $value]);
|
||||
} else {
|
||||
return $this->response()->fail(__('admin.upload_file_error'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,26 +2,26 @@
|
|||
|
||||
return [
|
||||
// 应用名称
|
||||
'name' => 'Owl Admin',
|
||||
'name' => 'Owl Admin',
|
||||
|
||||
// 应用 logo
|
||||
'logo' => '/admin-assets/logo.png',
|
||||
'logo' => '/admin-assets/logo.png',
|
||||
|
||||
// 默认头像
|
||||
'default_avatar' => '/admin-assets/default-avatar.png',
|
||||
|
||||
// 应用安装目录
|
||||
'directory' => app_path('Admin'),
|
||||
'directory' => app_path('Admin'),
|
||||
|
||||
// 引导文件
|
||||
'bootstrap' => app_path('Admin/bootstrap.php'),
|
||||
'bootstrap' => app_path('Admin/bootstrap.php'),
|
||||
|
||||
// 应用路由
|
||||
'route' => [
|
||||
'prefix' => 'admin-api',
|
||||
'domain' => null,
|
||||
'namespace' => 'App\\Admin\\Controllers',
|
||||
'middleware' => ['admin'],
|
||||
'route' => [
|
||||
'prefix' => 'admin-api',
|
||||
'domain' => null,
|
||||
'namespace' => 'App\\Admin\\Controllers',
|
||||
'middleware' => ['admin'],
|
||||
// 不包含额外路由, 配置后, 不会追加新增/详情/编辑页面路由
|
||||
'without_extra_routes' => [
|
||||
'/dashboard',
|
||||
|
|
@ -32,60 +32,60 @@ return [
|
|||
// 是否开启验证码
|
||||
'login_captcha' => env('ADMIN_LOGIN_CAPTCHA', true),
|
||||
// 是否开启认证
|
||||
'enable' => true,
|
||||
'enable' => true,
|
||||
// 是否开启鉴权
|
||||
'permission' => true,
|
||||
'guard' => 'admin',
|
||||
'guards' => [
|
||||
'permission' => true,
|
||||
'guard' => 'admin',
|
||||
'guards' => [
|
||||
'admin' => [
|
||||
'driver' => 'sanctum',
|
||||
'driver' => 'sanctum',
|
||||
'provider' => 'admin',
|
||||
],
|
||||
],
|
||||
'providers' => [
|
||||
'providers' => [
|
||||
'admin' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => \App\Models\AdminUser::class,
|
||||
'model' => \App\Models\AdminUser::class,
|
||||
],
|
||||
],
|
||||
'except' => [
|
||||
'except' => [
|
||||
|
||||
],
|
||||
],
|
||||
|
||||
'upload' => [
|
||||
'disk' => env("FILESYSTEM_DISK", 'public'),
|
||||
'disk' => env('FILESYSTEM_DISK', 'public'),
|
||||
// 文件上传目录
|
||||
'directory' => [
|
||||
'image' => 'images',
|
||||
'file' => 'files',
|
||||
'rich' => 'rich',
|
||||
'file' => 'files',
|
||||
'rich' => 'rich',
|
||||
],
|
||||
],
|
||||
|
||||
'https' => env('ADMIN_HTTPS', false),
|
||||
'https' => env('ADMIN_HTTPS', false),
|
||||
|
||||
// 是否显示 [开发者工具]
|
||||
'show_development_tools' => env('ADMIN_SHOW_DEVELOPMENT_TOOLS', true),
|
||||
'show_development_tools' => env('ADMIN_SHOW_DEVELOPMENT_TOOLS', true),
|
||||
|
||||
// 是否显示 [权限] 功能中的自动生成按钮
|
||||
'show_auto_generate_permission_button' => env('ADMIN_SHOW_AUTO_GENERATE_PERMISSION_BUTTON', true),
|
||||
|
||||
// 扩展
|
||||
'extension' => [
|
||||
'extension' => [
|
||||
'dir' => base_path('extensions'),
|
||||
],
|
||||
|
||||
'layout' => [
|
||||
// 浏览器标题, 功能名称使用 %title% 代替
|
||||
'title' => '%title% | OwlAdmin',
|
||||
'header' => [
|
||||
'title' => '%title% | OwlAdmin',
|
||||
'header' => [
|
||||
// 是否显示 [刷新] 按钮
|
||||
'refresh' => true,
|
||||
'refresh' => true,
|
||||
// 是否显示 [暗色模式] 按钮
|
||||
'dark' => true,
|
||||
'dark' => true,
|
||||
// 是否显示 [全屏] 按钮
|
||||
'full_screen' => true,
|
||||
'full_screen' => true,
|
||||
// 是否显示 [主题配置] 按钮
|
||||
'theme_config' => true,
|
||||
],
|
||||
|
|
@ -100,7 +100,7 @@ return [
|
|||
*/
|
||||
'keep_alive_exclude' => [],
|
||||
// 底部信息
|
||||
'footer' => '<a href="https://github.com/slowlyo/owl-admin" target="_blank">Owl Admin</a>',
|
||||
'footer' => '<a href="https://github.com/slowlyo/owl-admin" target="_blank">Owl Admin</a>',
|
||||
],
|
||||
|
||||
'database' => [
|
||||
|
|
@ -108,9 +108,9 @@ return [
|
|||
],
|
||||
|
||||
'models' => [
|
||||
'admin_user' => \App\Models\AdminUser::class,
|
||||
'admin_role' => \App\Models\AdminRole::class,
|
||||
'admin_menu' => \Slowlyo\OwlAdmin\Models\AdminMenu::class,
|
||||
'admin_user' => \App\Models\AdminUser::class,
|
||||
'admin_role' => \App\Models\AdminRole::class,
|
||||
'admin_menu' => \Slowlyo\OwlAdmin\Models\AdminMenu::class,
|
||||
'admin_permission' => \Slowlyo\OwlAdmin\Models\AdminPermission::class,
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -56,21 +56,21 @@ return [
|
|||
'throw' => false,
|
||||
],
|
||||
|
||||
"oss" => [
|
||||
"driver" => "oss",
|
||||
"access_key_id" => env("OSS_ACCESS_KEY_ID"), // 必填, 阿里云的AccessKeyId
|
||||
"access_key_secret" => env("OSS_ACCESS_KEY_SECRET"), // 必填, 阿里云的AccessKeySecret
|
||||
"bucket" => env("OSS_BUCKET"), // 必填, 对象存储的Bucket, 示例: my-bucket
|
||||
"endpoint" => env("OSS_ENDPOINT"), // 必填, 对象存储的Endpoint, 示例: oss-cn-shanghai.aliyuncs.com
|
||||
"internal" => env("OSS_INTERNAL", null), // 选填, 内网上传地址,填写即启用 示例: oss-cn-shanghai-internal.aliyuncs.com
|
||||
"domain" => env("OSS_DOMAIN", null), // 选填, 绑定域名,填写即启用 示例: oss.my-domain.com
|
||||
"is_cname" => env("OSS_CNAME", false), // 选填, 若Endpoint为自定义域名,此项要为true,见:https://github.com/aliyun/aliyun-oss-php-sdk/blob/572d0f8e099e8630ae7139ed3fdedb926c7a760f/src/OSS/OssClient.php#L113C1-L122C78
|
||||
"prefix" => env("OSS_PREFIX", ""), // 选填, 统一存储地址前缀
|
||||
"use_ssl" => env("OSS_SSL", false), // 选填, 是否使用HTTPS
|
||||
"reverse_proxy" => env("OSS_REVERSE_PROXY", false), // 选填, 域名是否使用NGINX代理绑定
|
||||
"throw" => env("OSS_THROW", true), // 选填, 是否抛出引起错误的异常,默认出现错误时,不抛出异常仅返回false
|
||||
"options" => [], // 选填, 添加全局配置参数, 示例: [\OSS\OssClient::OSS_CHECK_MD5 => false]
|
||||
"macros" => [] // 选填, 添加自定义Macro, 示例: [\App\Macros\ListBuckets::class, \App\Macros\CreateBucket::class]
|
||||
'oss' => [
|
||||
'driver' => 'oss',
|
||||
'access_key_id' => env('OSS_ACCESS_KEY_ID'), // 必填, 阿里云的AccessKeyId
|
||||
'access_key_secret' => env('OSS_ACCESS_KEY_SECRET'), // 必填, 阿里云的AccessKeySecret
|
||||
'bucket' => env('OSS_BUCKET'), // 必填, 对象存储的Bucket, 示例: my-bucket
|
||||
'endpoint' => env('OSS_ENDPOINT'), // 必填, 对象存储的Endpoint, 示例: oss-cn-shanghai.aliyuncs.com
|
||||
'internal' => env('OSS_INTERNAL', null), // 选填, 内网上传地址,填写即启用 示例: oss-cn-shanghai-internal.aliyuncs.com
|
||||
'domain' => env('OSS_DOMAIN', null), // 选填, 绑定域名,填写即启用 示例: oss.my-domain.com
|
||||
'is_cname' => env('OSS_CNAME', false), // 选填, 若Endpoint为自定义域名,此项要为true,见:https://github.com/aliyun/aliyun-oss-php-sdk/blob/572d0f8e099e8630ae7139ed3fdedb926c7a760f/src/OSS/OssClient.php#L113C1-L122C78
|
||||
'prefix' => env('OSS_PREFIX', ''), // 选填, 统一存储地址前缀
|
||||
'use_ssl' => env('OSS_SSL', false), // 选填, 是否使用HTTPS
|
||||
'reverse_proxy' => env('OSS_REVERSE_PROXY', false), // 选填, 域名是否使用NGINX代理绑定
|
||||
'throw' => env('OSS_THROW', true), // 选填, 是否抛出引起错误的异常,默认出现错误时,不抛出异常仅返回false
|
||||
'options' => [], // 选填, 添加全局配置参数, 示例: [\OSS\OssClient::OSS_CHECK_MD5 => false]
|
||||
'macros' => [], // 选填, 添加自定义Macro, 示例: [\App\Macros\ListBuckets::class, \App\Macros\CreateBucket::class]
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Slowlyo\OwlAdmin\Models\AdminMenu;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Slowlyo\OwlAdmin\Models\AdminMenu;
|
||||
use Throwable;
|
||||
|
||||
class AdminMenuSeeder extends Seeder
|
||||
|
|
@ -19,23 +18,23 @@ class AdminMenuSeeder extends Seeder
|
|||
{
|
||||
//
|
||||
$menus = [
|
||||
['title' => 'index', 'icon' => 'line-md:home-twotone-alt', 'url' => '/index', 'is_home'=>1, 'order'=>1],
|
||||
['title' => 'admin_system', 'icon' => 'material-symbols:settings-outline', 'url' => '/system', 'order'=>2,
|
||||
['title' => 'index', 'icon' => 'line-md:home-twotone-alt', 'url' => '/index', 'is_home' => 1, 'order' => 1],
|
||||
['title' => 'admin_system', 'icon' => 'material-symbols:settings-outline', 'url' => '/system', 'order' => 2,
|
||||
'children' => [
|
||||
['title' => 'admin_users', 'icon' => 'ph:user-gear', 'url' => '/system/admin_users', 'order'=>1],
|
||||
['title' => 'admin_roles', 'icon' => 'carbon:user-role', 'url' => '/system/admin_roles', 'order'=>2],
|
||||
['title' => 'admin_permission', 'icon' => 'carbon:user-role', 'url' => '/system/admin_permissions', 'order'=>3],
|
||||
['title' => 'admin_menu', 'icon' => 'fluent-mdl2:permissions', 'url' => '/system/admin_menus', 'order'=>4],
|
||||
['title' => 'admin_setting', 'icon' => 'akar-icons:settings-horizontal', 'url' => '/system/settings', 'order'=>5],
|
||||
['title' => 'keywords', 'icon' => 'ph:codesandbox-logo-light', 'url' => '/system/keywords', 'order'=>6]
|
||||
],
|
||||
['title' => 'admin_users', 'icon' => 'ph:user-gear', 'url' => '/system/admin_users', 'order' => 1],
|
||||
['title' => 'admin_roles', 'icon' => 'carbon:user-role', 'url' => '/system/admin_roles', 'order' => 2],
|
||||
['title' => 'admin_permission', 'icon' => 'carbon:user-role', 'url' => '/system/admin_permissions', 'order' => 3],
|
||||
['title' => 'admin_menu', 'icon' => 'fluent-mdl2:permissions', 'url' => '/system/admin_menus', 'order' => 4],
|
||||
['title' => 'admin_setting', 'icon' => 'akar-icons:settings-horizontal', 'url' => '/system/settings', 'order' => 5],
|
||||
['title' => 'keywords', 'icon' => 'ph:codesandbox-logo-light', 'url' => '/system/keywords', 'order' => 6],
|
||||
],
|
||||
],
|
||||
['title' => 'web_content', 'icon' => 'ic:outline-collections-bookmark', 'url' => '', 'order' => 3,
|
||||
'children' => [
|
||||
['title' => 'articles', 'icon' => 'ic:outline-article', 'url' => '/articles', 'order' => 1],
|
||||
['title' => 'ads', 'icon' => 'lets-icons:img-box', 'url' => '/ads', 'order' => 2],
|
||||
],
|
||||
],
|
||||
['title' => 'web_content', 'icon' => 'ic:outline-collections-bookmark', 'url' => '', 'order'=>3,
|
||||
'children' =>[
|
||||
['title'=>'articles', 'icon'=>'ic:outline-article','url'=>'/articles', 'order'=>1],
|
||||
['title'=>'ads', 'icon'=>'lets-icons:img-box','url'=>'/ads', 'order'=>2],
|
||||
]
|
||||
]
|
||||
];
|
||||
DB::table('admin_menus')->truncate();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ class AdminPermissionSeeder extends Seeder
|
|||
{
|
||||
foreach ($data as $slug => $node) {
|
||||
$permission = AdminPermission::updateOrCreate([
|
||||
'slug' => ($parent->slug ?? 'admin') . '.' . $slug,
|
||||
'slug' => ($parent->slug ?? 'admin').'.'.$slug,
|
||||
], [
|
||||
'parent_id' => $parent->id ?? 0,
|
||||
'name' => is_array($node) ? $node['name'] : $node,
|
||||
|
|
@ -143,7 +143,7 @@ class AdminPermissionSeeder extends Seeder
|
|||
|
||||
foreach ($resourceAbilities as $resourceAbility) {
|
||||
AdminPermission::updateOrCreate([
|
||||
'slug' => $permission->slug . '.' . $resourceAbility,
|
||||
'slug' => $permission->slug.'.'.$resourceAbility,
|
||||
], [
|
||||
'parent_id' => $permission->id,
|
||||
'name' => $this->resourceAbilityMap()[$resourceAbility],
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class KeywordSeeder extends Seeder
|
|||
[
|
||||
'key' => 'job',
|
||||
'name' => '职位',
|
||||
'children' => ['普通员工', '小组长', '主管']
|
||||
'children' => ['普通员工', '小组长', '主管'],
|
||||
],
|
||||
[
|
||||
'key' => 'store_category',
|
||||
|
|
@ -54,7 +54,7 @@ class KeywordSeeder extends Seeder
|
|||
['name' => '电脑整机'],
|
||||
['name' => '外设产品'],
|
||||
['name' => '网络产品'],
|
||||
]]
|
||||
]],
|
||||
],
|
||||
],
|
||||
[
|
||||
|
|
@ -86,7 +86,7 @@ class KeywordSeeder extends Seeder
|
|||
$item['sort'] = $i + 1;
|
||||
}
|
||||
|
||||
$key = Arr::pull($item, 'key', $parent?->key . '_' . ($i + 1));
|
||||
$key = Arr::pull($item, 'key', $parent?->key.'_'.($i + 1));
|
||||
|
||||
/** @var \App\Models\Keyword */
|
||||
$keyword = Keyword::updateOrCreate(
|
||||
|
|
|
|||
|
|
@ -1,219 +1,219 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'remember_me' => 'Remember me',
|
||||
'login' => 'Login',
|
||||
'logout' => 'Logout',
|
||||
'username' => 'Username',
|
||||
'password' => 'Password',
|
||||
'old_password' => 'Old Password',
|
||||
'remember_me' => 'Remember me',
|
||||
'login' => 'Login',
|
||||
'logout' => 'Logout',
|
||||
'username' => 'Username',
|
||||
'password' => 'Password',
|
||||
'old_password' => 'Old Password',
|
||||
'confirm_password' => 'Confirm Password',
|
||||
'captcha' => 'Captcha',
|
||||
'captcha_error' => 'Captcha Error',
|
||||
'required' => ':attribute is required',
|
||||
'captcha' => 'Captcha',
|
||||
'captcha_error' => 'Captcha Error',
|
||||
'required' => ':attribute is required',
|
||||
'login_successful' => 'Login Success',
|
||||
'login_failed' => 'Username Or Password Error',
|
||||
'user_setting' => 'User Settings',
|
||||
'created_at' => 'Created At',
|
||||
'updated_at' => 'Updated At',
|
||||
'deleted_at' => 'Deleted At',
|
||||
'actions' => 'Actions',
|
||||
'create' => 'Create',
|
||||
'edit' => 'Edit',
|
||||
'show' => 'Show',
|
||||
'delete' => 'Delete',
|
||||
'copy' => 'Copy',
|
||||
'confirm_delete' => 'Confirm Delete Selected Items?',
|
||||
'back' => 'Back',
|
||||
'reset' => 'Reset',
|
||||
'search' => 'Search',
|
||||
'list' => 'List',
|
||||
'add' => 'Add',
|
||||
'save' => 'Save',
|
||||
'detail' => 'Detail',
|
||||
'login_failed' => 'Username Or Password Error',
|
||||
'user_setting' => 'User Settings',
|
||||
'created_at' => 'Created At',
|
||||
'updated_at' => 'Updated At',
|
||||
'deleted_at' => 'Deleted At',
|
||||
'actions' => 'Actions',
|
||||
'create' => 'Create',
|
||||
'edit' => 'Edit',
|
||||
'show' => 'Show',
|
||||
'delete' => 'Delete',
|
||||
'copy' => 'Copy',
|
||||
'confirm_delete' => 'Confirm Delete Selected Items?',
|
||||
'back' => 'Back',
|
||||
'reset' => 'Reset',
|
||||
'search' => 'Search',
|
||||
'list' => 'List',
|
||||
'add' => 'Add',
|
||||
'save' => 'Save',
|
||||
'detail' => 'Detail',
|
||||
|
||||
'developer' => 'Developer',
|
||||
'code_generator' => 'Code Generator',
|
||||
'visual_editor' => 'Visual Editor',
|
||||
'terminal' => 'Terminal',
|
||||
'administrator' => 'Administrator',
|
||||
'soft_delete' => 'Soft Delete',
|
||||
'keyword' => 'Keyword',
|
||||
'unknown_error' => 'Unknown Error',
|
||||
'upload_file_error' => 'Upload File Error',
|
||||
'parent' => 'Parent',
|
||||
'order' => 'Order',
|
||||
'order_desc' => 'Order Desc',
|
||||
'order_asc' => 'Order Asc',
|
||||
'menus' => 'Menus',
|
||||
'successfully' => 'Successfully',
|
||||
'failed' => 'Failed',
|
||||
'successfully_message' => ':attribute Successfully',
|
||||
'failed_message' => ':attribute Failed',
|
||||
'action_success' => 'Action Success',
|
||||
'action_failed' => 'Action Failed',
|
||||
'save_success' => 'Save Success',
|
||||
'save_failed' => 'Save Failed',
|
||||
'yes' => 'Yes',
|
||||
'no' => 'No',
|
||||
'developer' => 'Developer',
|
||||
'code_generator' => 'Code Generator',
|
||||
'visual_editor' => 'Visual Editor',
|
||||
'terminal' => 'Terminal',
|
||||
'administrator' => 'Administrator',
|
||||
'soft_delete' => 'Soft Delete',
|
||||
'keyword' => 'Keyword',
|
||||
'unknown_error' => 'Unknown Error',
|
||||
'upload_file_error' => 'Upload File Error',
|
||||
'parent' => 'Parent',
|
||||
'order' => 'Order',
|
||||
'order_desc' => 'Order Desc',
|
||||
'order_asc' => 'Order Asc',
|
||||
'menus' => 'Menus',
|
||||
'successfully' => 'Successfully',
|
||||
'failed' => 'Failed',
|
||||
'successfully_message' => ':attribute Successfully',
|
||||
'failed_message' => ':attribute Failed',
|
||||
'action_success' => 'Action Success',
|
||||
'action_failed' => 'Action Failed',
|
||||
'save_success' => 'Save Success',
|
||||
'save_failed' => 'Save Failed',
|
||||
'yes' => 'Yes',
|
||||
'no' => 'No',
|
||||
'need_start_with_slash' => 'Need Start With /',
|
||||
'cancel' => 'Cancel',
|
||||
'please_login' => 'Please Login',
|
||||
'unauthorized' => 'Unauthorized',
|
||||
'cancel' => 'Cancel',
|
||||
'please_login' => 'Please Login',
|
||||
'unauthorized' => 'Unauthorized',
|
||||
|
||||
'code_generators' => [
|
||||
'remark1' => 'For more parameters, please refer to',
|
||||
'remark2' => 'Database Migration',
|
||||
'remark3' => 'Multiple parameters are separated by English commas',
|
||||
'table_name' => 'Table Name',
|
||||
'model_name' => 'Model',
|
||||
'controller_name' => 'Controller',
|
||||
'service_name' => 'Service',
|
||||
'primary_key' => 'Primary Key',
|
||||
'primary_key_description' => 'Use increments method',
|
||||
'options' => 'Options',
|
||||
'remark1' => 'For more parameters, please refer to',
|
||||
'remark2' => 'Database Migration',
|
||||
'remark3' => 'Multiple parameters are separated by English commas',
|
||||
'table_name' => 'Table Name',
|
||||
'model_name' => 'Model',
|
||||
'controller_name' => 'Controller',
|
||||
'service_name' => 'Service',
|
||||
'primary_key' => 'Primary Key',
|
||||
'primary_key_description' => 'Use increments method',
|
||||
'options' => 'Options',
|
||||
'create_database_migration' => 'Create Database Migration File',
|
||||
'create_table' => 'Create Table',
|
||||
'create_model' => 'Create Model',
|
||||
'create_controller' => 'Create Controller',
|
||||
'create_service' => 'Create Service',
|
||||
'app_title' => 'App Title',
|
||||
'column_name' => 'Column Name',
|
||||
'type' => 'Type',
|
||||
'extra_params' => 'Extra Params',
|
||||
'nullable' => 'Nullable',
|
||||
'index' => 'Index',
|
||||
'default_value' => 'Default Value',
|
||||
'comment' => 'Comment',
|
||||
'exists_table' => 'Exists Table',
|
||||
'generate_code' => 'Generate Code',
|
||||
'expand_more_settings' => 'More Settings',
|
||||
'collapse_settings' => 'Collapse Settings',
|
||||
'confirm_generate_code' => 'Confirm Generate Code?',
|
||||
'preview' => 'Preview',
|
||||
'base_info' => 'Base Info',
|
||||
'column_info' => 'Column Info',
|
||||
'route_config' => 'Route Config',
|
||||
'page_config' => 'Page Config',
|
||||
'gen_route_menu' => 'Generate Route And Menu',
|
||||
'route' => 'Route',
|
||||
'menu_name' => 'Menu Name',
|
||||
'parent_menu' => 'Parent Menu',
|
||||
'menu_icon' => 'Menu Icon',
|
||||
'name_label_desc' => 'Name And Label Attribute Take Field Name And Comment',
|
||||
'column_warning' => 'If the field name exists (no / status) will cause the form to fail to echo back!',
|
||||
'add_column' => 'Add Column',
|
||||
'scope' => 'Scope',
|
||||
'list_component' => 'List Component',
|
||||
'list_component_desc' => 'List Component, Default Is TableColumn',
|
||||
'form_component' => 'Form Component',
|
||||
'form_component_desc' => 'Form Component, Default Is TextControl',
|
||||
'detail_component' => 'Detail Component',
|
||||
'detail_component_desc' => 'Detail Component, Default Is TextControl',
|
||||
'model_config' => 'Model Config',
|
||||
'file_column' => 'File Column',
|
||||
'file_column_desc' => 'File Column, Automatically Add Attribute Methods In The Model',
|
||||
'preview_code' => 'Preview Code',
|
||||
'property' => 'Property',
|
||||
'property_name' => 'Property Name',
|
||||
'value' => 'Value',
|
||||
'dialog_form' => 'Dialog Form',
|
||||
'dialog_size' => 'Dialog Size',
|
||||
'copy_record' => 'Copy Record',
|
||||
'copy_record_description' => 'You can copy and share to <a href="https://github.com/Slowlyo/owl-admin/discussions/categories/%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90%E8%AE%B0%E5%BD%95" target="_blank">Github</a>',
|
||||
'import_record' => 'Import Record',
|
||||
'create_table' => 'Create Table',
|
||||
'create_model' => 'Create Model',
|
||||
'create_controller' => 'Create Controller',
|
||||
'create_service' => 'Create Service',
|
||||
'app_title' => 'App Title',
|
||||
'column_name' => 'Column Name',
|
||||
'type' => 'Type',
|
||||
'extra_params' => 'Extra Params',
|
||||
'nullable' => 'Nullable',
|
||||
'index' => 'Index',
|
||||
'default_value' => 'Default Value',
|
||||
'comment' => 'Comment',
|
||||
'exists_table' => 'Exists Table',
|
||||
'generate_code' => 'Generate Code',
|
||||
'expand_more_settings' => 'More Settings',
|
||||
'collapse_settings' => 'Collapse Settings',
|
||||
'confirm_generate_code' => 'Confirm Generate Code?',
|
||||
'preview' => 'Preview',
|
||||
'base_info' => 'Base Info',
|
||||
'column_info' => 'Column Info',
|
||||
'route_config' => 'Route Config',
|
||||
'page_config' => 'Page Config',
|
||||
'gen_route_menu' => 'Generate Route And Menu',
|
||||
'route' => 'Route',
|
||||
'menu_name' => 'Menu Name',
|
||||
'parent_menu' => 'Parent Menu',
|
||||
'menu_icon' => 'Menu Icon',
|
||||
'name_label_desc' => 'Name And Label Attribute Take Field Name And Comment',
|
||||
'column_warning' => 'If the field name exists (no / status) will cause the form to fail to echo back!',
|
||||
'add_column' => 'Add Column',
|
||||
'scope' => 'Scope',
|
||||
'list_component' => 'List Component',
|
||||
'list_component_desc' => 'List Component, Default Is TableColumn',
|
||||
'form_component' => 'Form Component',
|
||||
'form_component_desc' => 'Form Component, Default Is TextControl',
|
||||
'detail_component' => 'Detail Component',
|
||||
'detail_component_desc' => 'Detail Component, Default Is TextControl',
|
||||
'model_config' => 'Model Config',
|
||||
'file_column' => 'File Column',
|
||||
'file_column_desc' => 'File Column, Automatically Add Attribute Methods In The Model',
|
||||
'preview_code' => 'Preview Code',
|
||||
'property' => 'Property',
|
||||
'property_name' => 'Property Name',
|
||||
'value' => 'Value',
|
||||
'dialog_form' => 'Dialog Form',
|
||||
'dialog_size' => 'Dialog Size',
|
||||
'copy_record' => 'Copy Record',
|
||||
'copy_record_description' => 'You can copy and share to <a href="https://github.com/Slowlyo/owl-admin/discussions/categories/%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90%E8%AE%B0%E5%BD%95" target="_blank">Github</a>',
|
||||
'import_record' => 'Import Record',
|
||||
'import_record_placeholder' => 'Please enter the imported json record',
|
||||
'import_record_desc' => 'You can find some records shared by others on <a href="https://github.com/Slowlyo/owl-admin/discussions/categories/%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90%E8%AE%B0%E5%BD%95" target="_blank">Github</a>',
|
||||
'load_config' => 'Load Config',
|
||||
'load_component_config' => 'Load :c Config',
|
||||
'fill' => 'Fill',
|
||||
'save_current_config' => 'Save Current Config',
|
||||
'input_config_name' => 'Please Input Config Name',
|
||||
'same_name_tips' => 'Configurations with the same name will be overwritten',
|
||||
'import_record_desc' => 'You can find some records shared by others on <a href="https://github.com/Slowlyo/owl-admin/discussions/categories/%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90%E8%AE%B0%E5%BD%95" target="_blank">Github</a>',
|
||||
'load_config' => 'Load Config',
|
||||
'load_component_config' => 'Load :c Config',
|
||||
'fill' => 'Fill',
|
||||
'save_current_config' => 'Save Current Config',
|
||||
'input_config_name' => 'Please Input Config Name',
|
||||
'same_name_tips' => 'Configurations with the same name will be overwritten',
|
||||
],
|
||||
|
||||
'admin_users' => 'Admin Users',
|
||||
'admin_user' => [
|
||||
'avatar' => 'Avatar',
|
||||
'name' => 'Name',
|
||||
'roles' => 'Roles',
|
||||
'search_username' => 'Search Username/Name',
|
||||
'password_confirmation' => 'Password Not Match',
|
||||
'old_password_required' => 'Old Password Required',
|
||||
'old_password_error' => 'Old Password Error',
|
||||
'admin_user' => [
|
||||
'avatar' => 'Avatar',
|
||||
'name' => 'Name',
|
||||
'roles' => 'Roles',
|
||||
'search_username' => 'Search Username/Name',
|
||||
'password_confirmation' => 'Password Not Match',
|
||||
'old_password_required' => 'Old Password Required',
|
||||
'old_password_error' => 'Old Password Error',
|
||||
'username_already_exists' => 'Username Already Exists',
|
||||
],
|
||||
|
||||
'admin_roles' => 'Admin Roles',
|
||||
'admin_role' => [
|
||||
'name' => 'Name',
|
||||
'slug' => 'Slug',
|
||||
'permissions' => 'Permissions',
|
||||
'slug_description' => 'unique identifier of a role',
|
||||
'admin_role' => [
|
||||
'name' => 'Name',
|
||||
'slug' => 'Slug',
|
||||
'permissions' => 'Permissions',
|
||||
'slug_description' => 'unique identifier of a role',
|
||||
'name_already_exists' => 'Role Name Already Exists',
|
||||
'slug_already_exists' => 'Role Slug Already Exists',
|
||||
'set_permissions' => 'Set Permissions',
|
||||
'set_permissions' => 'Set Permissions',
|
||||
],
|
||||
|
||||
'admin_permissions' => 'Permissions',
|
||||
'admin_permission' => [
|
||||
'name' => 'Name',
|
||||
'slug' => 'Slug',
|
||||
'http_method' => 'Http Method',
|
||||
'admin_permission' => [
|
||||
'name' => 'Name',
|
||||
'slug' => 'Slug',
|
||||
'http_method' => 'Http Method',
|
||||
'http_method_description' => 'if you do not select the value is ANY',
|
||||
'http_path' => 'Http Path',
|
||||
'auto_generate' => 'Auto Generate',
|
||||
'auto_generate_confirm' => 'The permission information will be generated after the permission table and permission menu association table are truncated. Do you want to continue?',
|
||||
'parent_id_not_allow' => 'Parent Id Not Allow',
|
||||
'name_already_exists' => 'Permission Name Already Exists',
|
||||
'slug_already_exists' => 'Permission Slug Already Exists',
|
||||
'http_path' => 'Http Path',
|
||||
'auto_generate' => 'Auto Generate',
|
||||
'auto_generate_confirm' => 'The permission information will be generated after the permission table and permission menu association table are truncated. Do you want to continue?',
|
||||
'parent_id_not_allow' => 'Parent Id Not Allow',
|
||||
'name_already_exists' => 'Permission Name Already Exists',
|
||||
'slug_already_exists' => 'Permission Slug Already Exists',
|
||||
],
|
||||
|
||||
'admin_menus' => 'Menus',
|
||||
'admin_menu' => [
|
||||
'parent_id' => 'Parent',
|
||||
'order' => 'Order',
|
||||
'title' => 'Title',
|
||||
'icon' => 'Icon',
|
||||
'icon_description' => 'Please refer to ',
|
||||
'url' => 'Url',
|
||||
'visible' => 'Visible',
|
||||
'type' => 'Type',
|
||||
'api' => 'Page API',
|
||||
'api_description' => 'schemaApi, the api for page initialization requests, needs to be consistent with queryPath in Controller',
|
||||
'route' => 'Route',
|
||||
'link' => 'Link',
|
||||
'class_name' => 'Class Name',
|
||||
'admin_menu' => [
|
||||
'parent_id' => 'Parent',
|
||||
'order' => 'Order',
|
||||
'title' => 'Title',
|
||||
'icon' => 'Icon',
|
||||
'icon_description' => 'Please refer to ',
|
||||
'url' => 'Url',
|
||||
'visible' => 'Visible',
|
||||
'type' => 'Type',
|
||||
'api' => 'Page API',
|
||||
'api_description' => 'schemaApi, the api for page initialization requests, needs to be consistent with queryPath in Controller',
|
||||
'route' => 'Route',
|
||||
'link' => 'Link',
|
||||
'class_name' => 'Class Name',
|
||||
'class_name_description' => 'The CSS class name of the menu, which is typically used to customize styles',
|
||||
'show' => 'Show',
|
||||
'hide' => 'Hide',
|
||||
'is_home' => 'Is Home',
|
||||
'is_home_description' => 'In multi-tab mode, the page label is fixed on the left',
|
||||
'is_full' => 'Is Full',
|
||||
'is_full_description' => 'When enabled, the menu bar portion of the page is hidden',
|
||||
'parent_id_not_allow' => 'The parent menu cannot be set to the current submenu',
|
||||
'component' => 'Component',
|
||||
'component_desc' => 'amis by default. Not a custom front-end page, please do not modify it',
|
||||
'show' => 'Show',
|
||||
'hide' => 'Hide',
|
||||
'is_home' => 'Is Home',
|
||||
'is_home_description' => 'In multi-tab mode, the page label is fixed on the left',
|
||||
'is_full' => 'Is Full',
|
||||
'is_full_description' => 'When enabled, the menu bar portion of the page is hidden',
|
||||
'parent_id_not_allow' => 'The parent menu cannot be set to the current submenu',
|
||||
'component' => 'Component',
|
||||
'component_desc' => 'amis by default. Not a custom front-end page, please do not modify it',
|
||||
],
|
||||
|
||||
'extensions' => [
|
||||
'name_invalid' => 'Name Invalid',
|
||||
'exists' => 'This extension already exists: ',
|
||||
'menu' => 'Extensions',
|
||||
'page_title' => 'Extensions',
|
||||
'create' => 'Create',
|
||||
'install' => 'Install',
|
||||
'create_extension' => 'Create Extension',
|
||||
'create_tips' => 'After the directory is created, a basic extended directory structure is created under the <br><b>:dir</b><br> directory',
|
||||
'local_install' => 'Local Install',
|
||||
'more_extensions' => 'More Extensions',
|
||||
'setting' => 'Setting',
|
||||
'enable' => 'Enable',
|
||||
'enable_confirm' => 'Are you sure to enable the extension?',
|
||||
'disable' => 'Disable',
|
||||
'disable_confirm' => 'Are you sure to disable the extension?',
|
||||
'uninstall' => 'Uninstall',
|
||||
'uninstall_confirm' => '
|
||||
'name_invalid' => 'Name Invalid',
|
||||
'exists' => 'This extension already exists: ',
|
||||
'menu' => 'Extensions',
|
||||
'page_title' => 'Extensions',
|
||||
'create' => 'Create',
|
||||
'install' => 'Install',
|
||||
'create_extension' => 'Create Extension',
|
||||
'create_tips' => 'After the directory is created, a basic extended directory structure is created under the <br><b>:dir</b><br> directory',
|
||||
'local_install' => 'Local Install',
|
||||
'more_extensions' => 'More Extensions',
|
||||
'setting' => 'Setting',
|
||||
'enable' => 'Enable',
|
||||
'enable_confirm' => 'Are you sure to enable the extension?',
|
||||
'disable' => 'Disable',
|
||||
'disable_confirm' => 'Are you sure to disable the extension?',
|
||||
'uninstall' => 'Uninstall',
|
||||
'uninstall_confirm' => '
|
||||
<div class="text-danger">
|
||||
Confirm to uninstall the extension?<br>
|
||||
Uninstallation will delete all files and databases published after the extension is enabled and cannot be retrieved!!!<br>
|
||||
|
|
@ -222,34 +222,34 @@ Backup important data before performing operations!!!<br>
|
|||
</div>
|
||||
',
|
||||
'filter_placeholder' => 'Search by extension name',
|
||||
'form' => [
|
||||
'create_extension' => 'Create Extension',
|
||||
'name' => 'Name',
|
||||
'namespace' => 'Namespace',
|
||||
'form' => [
|
||||
'create_extension' => 'Create Extension',
|
||||
'name' => 'Name',
|
||||
'namespace' => 'Namespace',
|
||||
'create_description' => 'It will be created in :dir Directory to create a basic extended directory structure',
|
||||
],
|
||||
'card' => [
|
||||
'author' => 'Author',
|
||||
'version' => 'Version',
|
||||
'card' => [
|
||||
'author' => 'Author',
|
||||
'version' => 'Version',
|
||||
'homepage' => 'Home',
|
||||
'status' => 'Status',
|
||||
'status' => 'Status',
|
||||
],
|
||||
'status_map' => [
|
||||
'enabled' => 'Enabled',
|
||||
'status_map' => [
|
||||
'enabled' => 'Enabled',
|
||||
'disabled' => 'Disabled',
|
||||
],
|
||||
'validation' => [
|
||||
'file' => 'Please select file',
|
||||
'validation' => [
|
||||
'file' => 'Please select file',
|
||||
'invalid_package' => 'Invalid extension package',
|
||||
],
|
||||
],
|
||||
'export' => [
|
||||
'title' => 'Export',
|
||||
'all' => 'All',
|
||||
'page' => 'Current Page',
|
||||
'selected_rows' => 'Selected Rows',
|
||||
'page_no_data' => 'Current page has no data',
|
||||
'selected_rows_no_data' => 'No data is selected',
|
||||
'export' => [
|
||||
'title' => 'Export',
|
||||
'all' => 'All',
|
||||
'page' => 'Current Page',
|
||||
'selected_rows' => 'Selected Rows',
|
||||
'page_no_data' => 'Current page has no data',
|
||||
'selected_rows_no_data' => 'No data is selected',
|
||||
'please_install_laravel_excel' => 'Please install the package "maatwebsite/excel" first',
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'dashboard' => 'Dashboard',
|
||||
'admin_system' => 'Admin',
|
||||
'admin_users' => 'Users',
|
||||
'admin_roles' => 'Roles',
|
||||
'dashboard' => 'Dashboard',
|
||||
'admin_system' => 'Admin',
|
||||
'admin_users' => 'Users',
|
||||
'admin_roles' => 'Roles',
|
||||
'admin_permission' => 'Permissions',
|
||||
'admin_menu' => 'Menus',
|
||||
'admin_setting' => 'Settings',
|
||||
'admin_menu' => 'Menus',
|
||||
'admin_setting' => 'Settings',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,219 +1,219 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'remember_me' => '记住我',
|
||||
'login' => '登 录',
|
||||
'logout' => '退出登录',
|
||||
'username' => '用户名',
|
||||
'password' => '密码',
|
||||
'old_password' => '旧密码',
|
||||
'remember_me' => '记住我',
|
||||
'login' => '登 录',
|
||||
'logout' => '退出登录',
|
||||
'username' => '用户名',
|
||||
'password' => '密码',
|
||||
'old_password' => '旧密码',
|
||||
'confirm_password' => '确认密码',
|
||||
'captcha' => '验证码',
|
||||
'captcha_error' => '验证码有误',
|
||||
'required' => '请填写:attribute',
|
||||
'captcha' => '验证码',
|
||||
'captcha_error' => '验证码有误',
|
||||
'required' => '请填写:attribute',
|
||||
'login_successful' => '登录成功',
|
||||
'login_failed' => '用户名或密码错误',
|
||||
'user_setting' => '个人设置',
|
||||
'created_at' => '创建时间',
|
||||
'updated_at' => '更新时间',
|
||||
'deleted_at' => '删除时间',
|
||||
'actions' => '操作',
|
||||
'create' => '新增',
|
||||
'edit' => '编辑',
|
||||
'show' => '查看',
|
||||
'delete' => '删除',
|
||||
'copy' => '复制',
|
||||
'confirm_delete' => '确认删除选中项?',
|
||||
'back' => '返回',
|
||||
'reset' => '重置',
|
||||
'search' => '搜索',
|
||||
'list' => '列表',
|
||||
'add' => '新增',
|
||||
'save' => '保存',
|
||||
'detail' => '详情',
|
||||
'login_failed' => '用户名或密码错误',
|
||||
'user_setting' => '个人设置',
|
||||
'created_at' => '创建时间',
|
||||
'updated_at' => '更新时间',
|
||||
'deleted_at' => '删除时间',
|
||||
'actions' => '操作',
|
||||
'create' => '新增',
|
||||
'edit' => '编辑',
|
||||
'show' => '查看',
|
||||
'delete' => '删除',
|
||||
'copy' => '复制',
|
||||
'confirm_delete' => '确认删除选中项?',
|
||||
'back' => '返回',
|
||||
'reset' => '重置',
|
||||
'search' => '搜索',
|
||||
'list' => '列表',
|
||||
'add' => '新增',
|
||||
'save' => '保存',
|
||||
'detail' => '详情',
|
||||
|
||||
'developer' => '开发',
|
||||
'code_generator' => '代码生成器',
|
||||
'visual_editor' => '可视化编辑器',
|
||||
'terminal' => '终端',
|
||||
'administrator' => '管理员',
|
||||
'soft_delete' => '软删除',
|
||||
'keyword' => '关键字',
|
||||
'unknown_error' => '未知错误',
|
||||
'upload_file_error' => '上传文件错误',
|
||||
'parent' => '父级',
|
||||
'order' => '排序',
|
||||
'order_desc' => '降序排序',
|
||||
'order_asc' => '升序排序',
|
||||
'menus' => '菜单',
|
||||
'successfully' => '成功',
|
||||
'failed' => '失败',
|
||||
'successfully_message' => ':attribute成功',
|
||||
'failed_message' => ':attribute失败',
|
||||
'action_success' => '操作成功',
|
||||
'action_failed' => '操作失败',
|
||||
'save_success' => '保存成功',
|
||||
'save_failed' => '保存失败',
|
||||
'yes' => '是',
|
||||
'no' => '否',
|
||||
'developer' => '开发',
|
||||
'code_generator' => '代码生成器',
|
||||
'visual_editor' => '可视化编辑器',
|
||||
'terminal' => '终端',
|
||||
'administrator' => '管理员',
|
||||
'soft_delete' => '软删除',
|
||||
'keyword' => '关键字',
|
||||
'unknown_error' => '未知错误',
|
||||
'upload_file_error' => '上传文件错误',
|
||||
'parent' => '父级',
|
||||
'order' => '排序',
|
||||
'order_desc' => '降序排序',
|
||||
'order_asc' => '升序排序',
|
||||
'menus' => '菜单',
|
||||
'successfully' => '成功',
|
||||
'failed' => '失败',
|
||||
'successfully_message' => ':attribute成功',
|
||||
'failed_message' => ':attribute失败',
|
||||
'action_success' => '操作成功',
|
||||
'action_failed' => '操作失败',
|
||||
'save_success' => '保存成功',
|
||||
'save_failed' => '保存失败',
|
||||
'yes' => '是',
|
||||
'no' => '否',
|
||||
'need_start_with_slash' => '需要以 / 开头',
|
||||
'cancel' => '取消',
|
||||
'please_login' => '请先登录',
|
||||
'unauthorized' => '无权访问',
|
||||
'cancel' => '取消',
|
||||
'please_login' => '请先登录',
|
||||
'unauthorized' => '无权访问',
|
||||
|
||||
'code_generators' => [
|
||||
'remark1' => '额外参数请参考',
|
||||
'remark2' => '数据库迁移',
|
||||
'remark3' => '多个参数使用英文逗号分割',
|
||||
'table_name' => '表名',
|
||||
'model_name' => '模型',
|
||||
'controller_name' => '控制器',
|
||||
'service_name' => 'Service',
|
||||
'primary_key' => '主键名称',
|
||||
'primary_key_description' => '使用 increments 方法',
|
||||
'options' => '可选项',
|
||||
'remark1' => '额外参数请参考',
|
||||
'remark2' => '数据库迁移',
|
||||
'remark3' => '多个参数使用英文逗号分割',
|
||||
'table_name' => '表名',
|
||||
'model_name' => '模型',
|
||||
'controller_name' => '控制器',
|
||||
'service_name' => 'Service',
|
||||
'primary_key' => '主键名称',
|
||||
'primary_key_description' => '使用 increments 方法',
|
||||
'options' => '可选项',
|
||||
'create_database_migration' => '创建数据库迁移文件',
|
||||
'create_table' => '创建数据表',
|
||||
'create_model' => '创建模型',
|
||||
'create_controller' => '创建控制器',
|
||||
'create_service' => '创建Service',
|
||||
'app_title' => '功能名称',
|
||||
'column_name' => '字段名',
|
||||
'type' => '类型',
|
||||
'extra_params' => '额外参数',
|
||||
'nullable' => '允许空值',
|
||||
'index' => '索引',
|
||||
'default_value' => '默认值',
|
||||
'comment' => '注释',
|
||||
'exists_table' => '已有数据表',
|
||||
'generate_code' => '生成代码',
|
||||
'expand_more_settings' => '更多设置',
|
||||
'collapse_settings' => '收起设置',
|
||||
'confirm_generate_code' => '确认生成代码?',
|
||||
'preview' => '预览',
|
||||
'base_info' => '基本信息',
|
||||
'column_info' => '字段信息',
|
||||
'route_config' => '路由配置',
|
||||
'page_config' => '页面配置',
|
||||
'gen_route_menu' => '生成路由&菜单',
|
||||
'route' => '路由',
|
||||
'menu_name' => '菜单名称',
|
||||
'parent_menu' => '父级菜单',
|
||||
'menu_icon' => '菜单图标',
|
||||
'name_label_desc' => 'name和label属性取字段名和注释',
|
||||
'column_warning' => '如果字段名存在 no、status 会导致 form 回显失败!',
|
||||
'add_column' => '添加字段',
|
||||
'scope' => '作用域',
|
||||
'list_component' => '列表组件',
|
||||
'list_component_desc' => '列表组件, 默认为 TableColumn',
|
||||
'form_component' => '表单组件',
|
||||
'form_component_desc' => '表单组件, 默认为 TextControl',
|
||||
'detail_component' => '详情组件',
|
||||
'detail_component_desc' => '详情组件, 默认为 TextControl',
|
||||
'model_config' => '模型配置',
|
||||
'file_column' => '文件字段',
|
||||
'file_column_desc' => '文件字段会自动在模型中添加 获取/修改器 方法',
|
||||
'preview_code' => '预览代码',
|
||||
'property' => '属性',
|
||||
'property_name' => '属性名称',
|
||||
'value' => '值',
|
||||
'dialog_form' => '弹窗表单',
|
||||
'dialog_size' => '弹窗大小',
|
||||
'copy_record' => '复制记录',
|
||||
'copy_record_description' => '你可以复制后分享到 <a href="https://github.com/Slowlyo/owl-admin/discussions/categories/%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90%E8%AE%B0%E5%BD%95" target="_blank">Github</a>',
|
||||
'import_record' => '导入记录',
|
||||
'create_table' => '创建数据表',
|
||||
'create_model' => '创建模型',
|
||||
'create_controller' => '创建控制器',
|
||||
'create_service' => '创建Service',
|
||||
'app_title' => '功能名称',
|
||||
'column_name' => '字段名',
|
||||
'type' => '类型',
|
||||
'extra_params' => '额外参数',
|
||||
'nullable' => '允许空值',
|
||||
'index' => '索引',
|
||||
'default_value' => '默认值',
|
||||
'comment' => '注释',
|
||||
'exists_table' => '已有数据表',
|
||||
'generate_code' => '生成代码',
|
||||
'expand_more_settings' => '更多设置',
|
||||
'collapse_settings' => '收起设置',
|
||||
'confirm_generate_code' => '确认生成代码?',
|
||||
'preview' => '预览',
|
||||
'base_info' => '基本信息',
|
||||
'column_info' => '字段信息',
|
||||
'route_config' => '路由配置',
|
||||
'page_config' => '页面配置',
|
||||
'gen_route_menu' => '生成路由&菜单',
|
||||
'route' => '路由',
|
||||
'menu_name' => '菜单名称',
|
||||
'parent_menu' => '父级菜单',
|
||||
'menu_icon' => '菜单图标',
|
||||
'name_label_desc' => 'name和label属性取字段名和注释',
|
||||
'column_warning' => '如果字段名存在 no、status 会导致 form 回显失败!',
|
||||
'add_column' => '添加字段',
|
||||
'scope' => '作用域',
|
||||
'list_component' => '列表组件',
|
||||
'list_component_desc' => '列表组件, 默认为 TableColumn',
|
||||
'form_component' => '表单组件',
|
||||
'form_component_desc' => '表单组件, 默认为 TextControl',
|
||||
'detail_component' => '详情组件',
|
||||
'detail_component_desc' => '详情组件, 默认为 TextControl',
|
||||
'model_config' => '模型配置',
|
||||
'file_column' => '文件字段',
|
||||
'file_column_desc' => '文件字段会自动在模型中添加 获取/修改器 方法',
|
||||
'preview_code' => '预览代码',
|
||||
'property' => '属性',
|
||||
'property_name' => '属性名称',
|
||||
'value' => '值',
|
||||
'dialog_form' => '弹窗表单',
|
||||
'dialog_size' => '弹窗大小',
|
||||
'copy_record' => '复制记录',
|
||||
'copy_record_description' => '你可以复制后分享到 <a href="https://github.com/Slowlyo/owl-admin/discussions/categories/%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90%E8%AE%B0%E5%BD%95" target="_blank">Github</a>',
|
||||
'import_record' => '导入记录',
|
||||
'import_record_placeholder' => '请输入导入的json记录',
|
||||
'import_record_desc' => '你可以在 <a href="https://github.com/Slowlyo/owl-admin/discussions/categories/%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90%E8%AE%B0%E5%BD%95" target="_blank">Github</a> 找到一些其他人分享的记录',
|
||||
'load_config' => '加载配置',
|
||||
'load_component_config' => '加载 :c 配置',
|
||||
'fill' => '填充',
|
||||
'save_current_config' => '保存当前配置',
|
||||
'input_config_name' => '请填写配置名称',
|
||||
'same_name_tips' => '相同名称的配置将会被覆盖'
|
||||
'import_record_desc' => '你可以在 <a href="https://github.com/Slowlyo/owl-admin/discussions/categories/%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90%E8%AE%B0%E5%BD%95" target="_blank">Github</a> 找到一些其他人分享的记录',
|
||||
'load_config' => '加载配置',
|
||||
'load_component_config' => '加载 :c 配置',
|
||||
'fill' => '填充',
|
||||
'save_current_config' => '保存当前配置',
|
||||
'input_config_name' => '请填写配置名称',
|
||||
'same_name_tips' => '相同名称的配置将会被覆盖',
|
||||
],
|
||||
|
||||
'admin_users' => '管理员',
|
||||
'admin_user' => [
|
||||
'avatar' => '头像',
|
||||
'name' => '姓名',
|
||||
'roles' => '角色',
|
||||
'search_username' => '搜索用户名/名称',
|
||||
'password_confirmation' => '两次输入密码不一致',
|
||||
'old_password_required' => '请输入原密码',
|
||||
'old_password_error' => '原密码错误',
|
||||
'admin_user' => [
|
||||
'avatar' => '头像',
|
||||
'name' => '姓名',
|
||||
'roles' => '角色',
|
||||
'search_username' => '搜索用户名/名称',
|
||||
'password_confirmation' => '两次输入密码不一致',
|
||||
'old_password_required' => '请输入原密码',
|
||||
'old_password_error' => '原密码错误',
|
||||
'username_already_exists' => '用户名已存在',
|
||||
],
|
||||
|
||||
'admin_roles' => '角色',
|
||||
'admin_role' => [
|
||||
'name' => '名称',
|
||||
'slug' => '标识',
|
||||
'permissions' => '权限',
|
||||
'slug_description' => '角色的唯一标识, 不可重复',
|
||||
'admin_role' => [
|
||||
'name' => '名称',
|
||||
'slug' => '标识',
|
||||
'permissions' => '权限',
|
||||
'slug_description' => '角色的唯一标识, 不可重复',
|
||||
'name_already_exists' => '角色名称已存在',
|
||||
'slug_already_exists' => '角色标识已存在',
|
||||
'set_permissions' => '设置权限',
|
||||
'set_permissions' => '设置权限',
|
||||
],
|
||||
|
||||
'admin_permissions' => '权限',
|
||||
'admin_permission' => [
|
||||
'name' => '名称',
|
||||
'slug' => '标识',
|
||||
'http_method' => '请求方式',
|
||||
'admin_permission' => [
|
||||
'name' => '名称',
|
||||
'slug' => '标识',
|
||||
'http_method' => '请求方式',
|
||||
'http_method_description' => '不选则为ANY',
|
||||
'http_path' => '路由',
|
||||
'auto_generate' => '自动生成',
|
||||
'auto_generate_confirm' => '权限信息会在 截断权限表&权限菜单关联表 后重新生成, 是否继续操作 ?',
|
||||
'parent_id_not_allow' => '父级不允许设置为当前子权限',
|
||||
'name_already_exists' => '权限名称已存在',
|
||||
'slug_already_exists' => '权限标识已存在',
|
||||
'http_path' => '路由',
|
||||
'auto_generate' => '自动生成',
|
||||
'auto_generate_confirm' => '权限信息会在 截断权限表&权限菜单关联表 后重新生成, 是否继续操作 ?',
|
||||
'parent_id_not_allow' => '父级不允许设置为当前子权限',
|
||||
'name_already_exists' => '权限名称已存在',
|
||||
'slug_already_exists' => '权限标识已存在',
|
||||
],
|
||||
|
||||
'admin_menus' => '菜单',
|
||||
'admin_menu' => [
|
||||
'parent_id' => '父级',
|
||||
'order' => '排序',
|
||||
'title' => '名称',
|
||||
'icon' => '图标',
|
||||
'icon_description' => '请参考',
|
||||
'url' => '链接',
|
||||
'visible' => '可见',
|
||||
'type' => '类型',
|
||||
'api' => '页面Api',
|
||||
'api_description' => 'schemaApi, 页面初始化请求的api, 需要与Controller中的queryPath一致',
|
||||
'route' => '路由',
|
||||
'link' => '外链',
|
||||
'class_name' => '类名',
|
||||
'admin_menu' => [
|
||||
'parent_id' => '父级',
|
||||
'order' => '排序',
|
||||
'title' => '名称',
|
||||
'icon' => '图标',
|
||||
'icon_description' => '请参考',
|
||||
'url' => '链接',
|
||||
'visible' => '可见',
|
||||
'type' => '类型',
|
||||
'api' => '页面Api',
|
||||
'api_description' => 'schemaApi, 页面初始化请求的api, 需要与Controller中的queryPath一致',
|
||||
'route' => '路由',
|
||||
'link' => '外链',
|
||||
'class_name' => '类名',
|
||||
'class_name_description' => '菜单的CSS类名, 一般用于自定义样式',
|
||||
'show' => '可见',
|
||||
'hide' => '隐藏',
|
||||
'is_home' => '首页',
|
||||
'is_home_description' => '在多页签卡模式下,页面标签将固定在左侧',
|
||||
'is_full' => '全屏',
|
||||
'is_full_description' => '开启后将隐藏该页面的菜单栏部分',
|
||||
'parent_id_not_allow' => '父级菜单不允许设置为当前子菜单',
|
||||
'component' => '组件',
|
||||
'component_desc' => '默认为 amis , 非自定义前端页面请勿修改',
|
||||
'show' => '可见',
|
||||
'hide' => '隐藏',
|
||||
'is_home' => '首页',
|
||||
'is_home_description' => '在多页签卡模式下,页面标签将固定在左侧',
|
||||
'is_full' => '全屏',
|
||||
'is_full_description' => '开启后将隐藏该页面的菜单栏部分',
|
||||
'parent_id_not_allow' => '父级菜单不允许设置为当前子菜单',
|
||||
'component' => '组件',
|
||||
'component_desc' => '默认为 amis , 非自定义前端页面请勿修改',
|
||||
],
|
||||
|
||||
'extensions' => [
|
||||
'name_invalid' => '无效的扩展名称',
|
||||
'exists' => '该扩展已存在:',
|
||||
'menu' => '扩展',
|
||||
'page_title' => '扩展',
|
||||
'create' => '创建',
|
||||
'install' => '安装',
|
||||
'create_extension' => '创建扩展',
|
||||
'create_tips' => '创建成功后会在<br><b>:dir</b><br>目录下创建基础的扩展目录结构',
|
||||
'local_install' => '本地安装',
|
||||
'more_extensions' => '更多扩展',
|
||||
'setting' => '设置',
|
||||
'enable' => '启用',
|
||||
'enable_confirm' => '确定要启用该扩展吗?',
|
||||
'disable' => '禁用',
|
||||
'disable_confirm' => '确定要禁用该扩展吗?',
|
||||
'uninstall' => '卸载',
|
||||
'uninstall_confirm' => '
|
||||
'name_invalid' => '无效的扩展名称',
|
||||
'exists' => '该扩展已存在:',
|
||||
'menu' => '扩展',
|
||||
'page_title' => '扩展',
|
||||
'create' => '创建',
|
||||
'install' => '安装',
|
||||
'create_extension' => '创建扩展',
|
||||
'create_tips' => '创建成功后会在<br><b>:dir</b><br>目录下创建基础的扩展目录结构',
|
||||
'local_install' => '本地安装',
|
||||
'more_extensions' => '更多扩展',
|
||||
'setting' => '设置',
|
||||
'enable' => '启用',
|
||||
'enable_confirm' => '确定要启用该扩展吗?',
|
||||
'disable' => '禁用',
|
||||
'disable_confirm' => '确定要禁用该扩展吗?',
|
||||
'uninstall' => '卸载',
|
||||
'uninstall_confirm' => '
|
||||
<div class="text-danger">
|
||||
确认卸载该扩展?<br>
|
||||
卸载将会删除启用扩展后发布的所有文件及数据库, 且不可找回!!!<br>
|
||||
|
|
@ -222,34 +222,34 @@ return [
|
|||
</div>
|
||||
',
|
||||
'filter_placeholder' => '输入扩展名称',
|
||||
'form' => [
|
||||
'create_extension' => '创建扩展',
|
||||
'name' => '名称',
|
||||
'namespace' => '命名空间',
|
||||
'form' => [
|
||||
'create_extension' => '创建扩展',
|
||||
'name' => '名称',
|
||||
'namespace' => '命名空间',
|
||||
'create_description' => '创建成功后会在 :dir 目录下创建基础的扩展目录结构',
|
||||
],
|
||||
'card' => [
|
||||
'author' => '作者',
|
||||
'version' => '版本',
|
||||
'card' => [
|
||||
'author' => '作者',
|
||||
'version' => '版本',
|
||||
'homepage' => '主页',
|
||||
'status' => '状态',
|
||||
'status' => '状态',
|
||||
],
|
||||
'status_map' => [
|
||||
'enabled' => '已启用',
|
||||
'status_map' => [
|
||||
'enabled' => '已启用',
|
||||
'disabled' => '已禁用',
|
||||
],
|
||||
'validation' => [
|
||||
'file' => '请选择文件',
|
||||
'validation' => [
|
||||
'file' => '请选择文件',
|
||||
'invalid_package' => '无效的扩展包',
|
||||
],
|
||||
],
|
||||
'export' => [
|
||||
'title' => '导出',
|
||||
'all' => '全部',
|
||||
'page' => '本页',
|
||||
'selected_rows' => '选中行',
|
||||
'page_no_data' => '本页无数据',
|
||||
'selected_rows_no_data' => '请选择要导出的数据',
|
||||
'export' => [
|
||||
'title' => '导出',
|
||||
'all' => '全部',
|
||||
'page' => '本页',
|
||||
'selected_rows' => '选中行',
|
||||
'page_no_data' => '本页无数据',
|
||||
'selected_rows_no_data' => '请选择要导出的数据',
|
||||
'please_install_laravel_excel' => '请先安装 laravel-excel 扩展',
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'dashboard' => '控制台',
|
||||
'admin_system' => '系统管理',
|
||||
'admin_users' => '管理员',
|
||||
'admin_roles' => '角色',
|
||||
'dashboard' => '控制台',
|
||||
'admin_system' => '系统管理',
|
||||
'admin_users' => '管理员',
|
||||
'admin_roles' => '角色',
|
||||
'admin_permission' => '权限',
|
||||
'admin_menu' => '菜单',
|
||||
'admin_setting' => '设置',
|
||||
'admin_menu' => '菜单',
|
||||
'admin_setting' => '设置',
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue