编码风格

main
Jing Li 2024-03-23 19:59:59 +08:00
parent 7efc12327e
commit 970cef0c32
47 changed files with 976 additions and 948 deletions

View File

@ -6,48 +6,50 @@ use App\Models\Keyword;
use Slowlyo\OwlAdmin\Renderers\BaseRenderer; use Slowlyo\OwlAdmin\Renderers\BaseRenderer;
use Slowlyo\OwlAdmin\Renderers\WangEditor; 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) return amisMake()->TreeSelectControl()->source($apiUrl)
->name($name)->label($label ?? __('admin.components.parent_select')) ->name($name)->label($label ?? __('admin.components.parent_select'))
->showIcon(false) ->showIcon(false)
->labelField($labelField) ->labelField($labelField)
->valueField($valueField); ->valueField($valueField);
} }
/** /**
* 排序字段 * 排序字段
*/ */
public function sortControl($name ='sort', $label = null){ public function sortControl($name = 'sort', $label = null)
{
return amisMake()->NumberControl() return amisMake()->NumberControl()
->name($name)->label($label ?? __('admin.components.order')) ->name($name)->label($label ?? __('admin.components.order'))
->displayMode('enhance') ->displayMode('enhance')
->value(0) ->value(0)
->min(0); ->min(0);
} }
/** /**
* 2位小数输入框 * 2位小数输入框
*/ */
public function decimalControl($name ='decimal', $label = null){ public function decimalControl($name = 'decimal', $label = null)
{
return amisMake()->NumberControl() return amisMake()->NumberControl()
->name($name)->label($label ?? __('admin.components.decimal')) ->name($name)->label($label ?? __('admin.components.decimal'))
->kilobitSeparator(true) ->kilobitSeparator(true)
->percision(2) ->percision(2)
->step(0.01) ->step(0.01)
->value(0.00) ->value(0.00)
->min(0); ->min(0);
} }
/** /**
* 富文本编辑器 * 富文本编辑器
*/ */
public function fuEditorControl($name ='content', $label = null, $height = 530) public function fuEditorControl($name = 'content', $label = null, $height = 530)
{ {
return WangEditor::make() return WangEditor::make()
->name($name)->label($label ?? __('admin.components.content')) ->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() return amisMake()->SwitchControl()
->name($name)->label($label ?? __('admin.components.status')) ->name($name)->label($label ?? __('admin.components.status'))
->mode($mode) ->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) return amis()->ImageControl($name, $label)
->joinValues(false) ->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); $cropImage = amis()->ImageControl($name, $label)->joinValues(false);
// if($aspectRatio){ // if($aspectRatio){
$cropImage->crop([ $cropImage->crop([
'aspectRatio' => $aspectRatio ?? 1 'aspectRatio' => $aspectRatio ?? 1,
]); ]);
// } // }
$cropImage->autoUpload(true); $cropImage->autoUpload(true);
return $cropImage; 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')) return amis()->FileControl($name, $label ?? __('admin.components.files'))
->multiple($multiple) ->multiple($multiple)
->joinValues(false) ->joinValues(false)
->useChunk(false) ->useChunk(false)
->maxSize(20*1024*1024) ->maxSize(20 * 1024 * 1024)
->accept($accept); ->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')) return amis()->FileControl($name, $label ?? __('admin.components.files'))
->multiple($multiple) ->multiple($multiple)
->joinValues(false) ->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() return amisMake()->TagControl()
->name($name)->label($label ?? __('admin.components.tag')) ->name($name)->label($label ?? __('admin.components.tag'))
->maxTagLength(0) ->maxTagLength(0)
->options(Keyword::where('parent_key', $pKey)->pluck('name', 'id')->toArray()); ->options(Keyword::where('parent_key', $pKey)->pluck('name', 'id')->toArray());
} }
public function keywordsTag($label = null, $color = null){ public function keywordsTag($label = null, $color = null)
if($color){ {
if ($color) {
$tag = amisMake()->Tag()->label($label ?? __('admin.components.tag')) $tag = amisMake()->Tag()->label($label ?? __('admin.components.tag'))
->displayMode('rounded')->style([ ->displayMode('rounded')->style([
'color' => '#fff', 'color' => '#fff',
'backgroundColor' =>$color, 'backgroundColor' => $color,
'borderColor' => $color 'borderColor' => $color,
]); ]);
}else{ } else {
$tag = amisMake()->Tag()->label($label ?? __('admin.components.tag')) $tag = amisMake()->Tag()->label($label ?? __('admin.components.tag'))
->displayMode('rounded')->color('inactive'); ->displayMode('rounded')->color('inactive');
} }
return $tag; return $tag;
} }
@ -140,36 +151,37 @@ class Components extends BaseRenderer {
* 生成统计图config * 生成统计图config
* 折线图或者柱状图 * 折线图或者柱状图
*/ */
public function chartLineBarConfig($title = null, array $x , array $y){ public function chartLineBarConfig($title, array $x, array $y)
{
$yAxisData = []; $yAxisData = [];
$seriesData = []; $seriesData = [];
$color = []; $color = [];
if(!isset($y[0])){ if (! isset($y[0])) {
$_y = $y; $_y = $y;
$y = [0=>$_y]; $y = [0 => $_y];
} }
$i = 0; $i = 0;
$tips = '{b0}'; $tips = '{b0}';
foreach($y as $item) { foreach ($y as $item) {
//调色盘 //调色盘
$color[] = $item['color']; $color[] = $item['color'];
//tips //tips
$tips.= '<br/> {a'.$i.'}: {c'.$i.'}'.($item['unit'] ?? ''); $tips .= '<br/> {a'.$i.'}: {c'.$i.'}'.($item['unit'] ?? '');
//纵坐标 //纵坐标
$yAxisData[] = [ $yAxisData[] = [
'name'=>($item['unit'] ?? ''), 'name' => ($item['unit'] ?? ''),
'type' =>'value', 'type' => 'value',
'axisTick' => true, 'axisTick' => true,
'alignTicks' => true, 'alignTicks' => true,
'axisLine' => [ 'axisLine' => [
'show' => true, 'show' => true,
'lineStyle' => [ 'lineStyle' => [
'color' => $item['color'] ?? '' 'color' => $item['color'] ?? '',
] ],
],
'axisLabel' => [
'formatter' => '{value} ',
], ],
'axisLabel'=> [
'formatter'=>'{value} '
]
]; ];
//数据 //数据
$_series = [ $_series = [
@ -178,16 +190,16 @@ class Components extends BaseRenderer {
'type' => $item['type'] ?? 'line', 'type' => $item['type'] ?? 'line',
'yAxisIndex' => $i, 'yAxisIndex' => $i,
]; ];
switch($item['type']){ switch ($item['type']) {
case 'line': case 'line':
$_series = array_merge($_series, [ $_series = array_merge($_series, [
'smooth'=> true, 'smooth' => true,
'symbol'=> 'none', 'symbol' => 'none',
'lineStyle' => [ 'lineStyle' => [
'color' => $item['color'] ?? '' 'color' => $item['color'] ?? '',
], ],
'areaStyle' => [ 'areaStyle' => [
'color' => $item['color'] ?? '' 'color' => $item['color'] ?? '',
], ],
]); ]);
break; break;
@ -201,14 +213,14 @@ class Components extends BaseRenderer {
} }
return [ return [
'color' => $color, 'color' => $color,
'title' => [ 'title' => [
'text' => $title, 'text' => $title,
], ],
"tooltip" => [//提示 'tooltip' => [//提示
'trigger'=>'axis',//坐标轴触发 'trigger' => 'axis', //坐标轴触发
'axisPointer' => [ 'axisPointer' => [
'type' => 'cross' 'type' => 'cross',
], ],
// 'formatter' => $tips // 'formatter' => $tips
], ],
@ -221,21 +233,22 @@ class Components extends BaseRenderer {
'data' => $x, 'data' => $x,
], ],
'yAxis' => $yAxisData, '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 = []; $yAxisData = [];
$seriesData = []; $seriesData = [];
$color = []; $color = [];
if($yData){ if ($yData) {
$yAxisData = [ $yAxisData = [
'type' =>'category', 'type' => 'category',
// 'splitLine'=>[ // 'splitLine'=>[
// 'show'=>true, // 'show'=>true,
// 'lineStyle'=>[ // 'lineStyle'=>[
@ -243,23 +256,23 @@ class Components extends BaseRenderer {
// ] // ]
// ], // ],
'axisTick' => [ 'axisTick' => [
'alignWithLabel'=>true 'alignWithLabel' => true,
], ],
'data'=> $yData 'data' => $yData,
]; ];
} }
$seriesData = $y; $seriesData = $y;
return [ return [
'color' => $color, 'color' => $color,
'title' => [ 'title' => [
'text' => $title, 'text' => $title,
], ],
"tooltip" => [//提示 'tooltip' => [//提示
'trigger'=>'axis',//坐标轴触发 'trigger' => 'axis', //坐标轴触发
'axisPointer' => [ 'axisPointer' => [
'type' => 'cross' 'type' => 'cross',
], ],
], ],
'xAxis' => [ 'xAxis' => [
@ -267,7 +280,7 @@ class Components extends BaseRenderer {
'data' => $x, 'data' => $x,
], ],
'yAxis' => $yAxisData, 'yAxis' => $yAxisData,
'series' => $seriesData 'series' => $seriesData,
]; ];
} }
@ -275,7 +288,8 @@ class Components extends BaseRenderer {
* 生成饼状图config * 生成饼状图config
* -todo * -todo
*/ */
public function chartPieConfig(){ public function chartPieConfig()
return ; {
} }
} }

View File

@ -31,14 +31,14 @@ class AdController extends AdminController
->filter($this->baseFilter()->labelWidth('80px')->body([ ->filter($this->baseFilter()->labelWidth('80px')->body([
amis()->GroupControl()->mode('horizontal')->body([ amis()->GroupControl()->mode('horizontal')->body([
amis()->TextControl('id', __('admin.ads.id')) amis()->TextControl('id', __('admin.ads.id'))
->placeholder(__('admin.id')), ->placeholder(__('admin.id')),
amis()->TextControl('remark', __('admin.ads.remark')) 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'), 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')) amis()->SelectControl('enable', __('admin.ads.is_enable'))
->options([ ->options([
1=>'开启',0=>'关闭' 1 => '开启', 0 => '关闭',
]), ]),
]), ]),
amis()->GroupControl()->mode('horizontal')->body([ amis()->GroupControl()->mode('horizontal')->body([
amis()->InputDatetimeRange()->label(__('admin.ads.published_at'))->name('published_at'), 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()->NumberControl()->min(0)->saveImmediately(true)
), ),
amis()->TableColumn('resource', __('admin.ads.resource'))->type('image')->height('50px')->width('150px')->enlargeAble(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('published_at', __('admin.ads.published_at'))->remark(__('admin.ads.published_at_remark')),
amis()->TableColumn('is_enable', __('admin.ads.is_enable'))->type('switch'), 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([ Operation::make()->label(__('admin.actions'))->buttons([
$this->rowEditButton(), $this->rowEditButton(),
$this->rowDeleteButton(), $this->rowDeleteButton(),
]) ]),
]); ]);
return $this->baseList($crud); return $this->baseList($crud);
@ -71,7 +71,7 @@ class AdController extends AdminController
{ {
return $this->baseForm()->body([ 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()->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')), amis()->TextControl('remark', __('admin.ads.remark')),
Components::make()->sortControl('sort', __('admin.ads.sort')), 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')), 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([ return $this->baseDetail()->body([
amis()->TextControl('id', 'ID')->static(), amis()->TextControl('id', 'ID')->static(),
amis()->TextControl('created_at', __('admin.created_at'))->static(), amis()->TextControl('created_at', __('admin.created_at'))->static(),
amis()->TextControl('updated_at', __('admin.updated_at'))->static() amis()->TextControl('updated_at', __('admin.updated_at'))->static(),
]); ]);
} }
} }

View File

@ -2,8 +2,8 @@
namespace App\Admin\Controllers; namespace App\Admin\Controllers;
use Slowlyo\OwlAdmin\Renderers\Page;
use Slowlyo\OwlAdmin\Controllers\AdminRoleController as AdminRoleBaseController; use Slowlyo\OwlAdmin\Controllers\AdminRoleController as AdminRoleBaseController;
use Slowlyo\OwlAdmin\Renderers\Page;
class AdminRoleController extends AdminRoleBaseController class AdminRoleController extends AdminRoleBaseController
{ {
@ -38,13 +38,13 @@ class AdminRoleController extends AdminRoleBaseController
]); ]);
return $this->baseList($crud)->css([ return $this->baseList($crud)->css([
'.tree-full' => [ '.tree-full' => [
'overflow' => 'hidden !important', 'overflow' => 'hidden !important',
], ],
'.cxd-TreeControl > .cxd-Tree' => [ '.cxd-TreeControl > .cxd-Tree' => [
'height' => '100% !important', 'height' => '100% !important',
'max-height' => '100% !important', 'max-height' => '100% !important',
], ],
]); ]);
} }
} }

View File

@ -83,8 +83,8 @@ class AdminUserController extends AdminController
amisMake()->Dialog()->title(__('admin.admin_user.edit_password'))->body([ amisMake()->Dialog()->title(__('admin.admin_user.edit_password'))->body([
amisMake()->Form()->title('') amisMake()->Form()->title('')
->api([ ->api([
'method'=>'PUT', 'method' => 'PUT',
'url'=> admin_url('system/admin_users/$id') 'url' => admin_url('system/admin_users/$id'),
]) ])
->body([ ->body([
amisMake()->TextControl('id')->value('${id}')->hidden(true), amisMake()->TextControl('id')->value('${id}')->hidden(true),

View File

@ -4,7 +4,6 @@ namespace App\Admin\Controllers;
use App\Admin\Components; use App\Admin\Components;
use App\Admin\Services\ArticleService; use App\Admin\Services\ArticleService;
use App\Casts\Storage;
use App\Models\Keyword; use App\Models\Keyword;
use App\Traits\CustomActionTrait; use App\Traits\CustomActionTrait;
use Slowlyo\OwlAdmin\Admin; use Slowlyo\OwlAdmin\Admin;
@ -15,9 +14,10 @@ use Slowlyo\OwlAdmin\Renderers\Page;
class ArticleController extends AdminController class ArticleController extends AdminController
{ {
use CustomActionTrait; use CustomActionTrait;
protected string $serviceName = ArticleService::class; protected string $serviceName = ArticleService::class;
public function list():Page public function list(): Page
{ {
$crud = $this->baseCRUD()->tableLayout('fixed') $crud = $this->baseCRUD()->tableLayout('fixed')
->headerToolbar([ ->headerToolbar([
@ -27,9 +27,9 @@ class ArticleController extends AdminController
->filter($this->baseFilter()->body([ ->filter($this->baseFilter()->body([
amis()->GroupControl()->mode('horizontal')->body([ amis()->GroupControl()->mode('horizontal')->body([
amis()->TextControl('id', __('admin.articles.id')) amis()->TextControl('id', __('admin.articles.id'))
->placeholder(__('admin.id')), ->placeholder(__('admin.id')),
amis()->TextControl('title', __('admin.articles.title')) 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()->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()->keywordsTagControl('t_ids', __('admin.articles.tags'), 'article_tag'),
]), ]),
@ -37,12 +37,12 @@ class ArticleController extends AdminController
amis()->SelectControl('enable', __('admin.articles.is_enable')) amis()->SelectControl('enable', __('admin.articles.is_enable'))
->columnRatio(3) ->columnRatio(3)
->options([ ->options([
1=>'开启',0=>'关闭' 1 => '开启', 0 => '关闭',
]), ]),
amis()->SelectControl('recommend', __('admin.articles.is_recommend')) amis()->SelectControl('recommend', __('admin.articles.is_recommend'))
->columnRatio(3) ->columnRatio(3)
->options([ ->options([
1=>'开启',0=>'关闭' 1 => '开启', 0 => '关闭',
]), ]),
amis()->InputDatetimeRange()->label(__('admin.articles.published_at'))->name('published_at'), amis()->InputDatetimeRange()->label(__('admin.articles.published_at'))->name('published_at'),
]), ]),
@ -56,7 +56,7 @@ class ArticleController extends AdminController
'position' => 'top-left', 'position' => 'top-left',
'badgeLevel' => 'danger', 'badgeLevel' => 'danger',
'visibleOn' => '${is_recommend > 0}', 'visibleOn' => '${is_recommend > 0}',
'size' => 15 'size' => 15,
]) ])
->columns([ ->columns([
amis()->TableColumn('id', __('admin.id'))->sortable(true), amis()->TableColumn('id', __('admin.id'))->sortable(true),
@ -73,7 +73,7 @@ class ArticleController extends AdminController
amis()->Operation()->label(__('admin.actions'))->buttons([ amis()->Operation()->label(__('admin.actions'))->buttons([
$this->rowEditTypeButton('drawer', 'xl'), $this->rowEditTypeButton('drawer', 'xl'),
$this->rowDeleteButton(), $this->rowDeleteButton(),
]) ]),
]); ]);
return $this->baseList($crud); return $this->baseList($crud);
@ -84,10 +84,10 @@ class ArticleController extends AdminController
return $this->baseForm()->panelClassName('px-0')->body([ return $this->baseForm()->panelClassName('px-0')->body([
amis()->Grid()->columns([ amis()->Grid()->columns([
amis()->Wrapper()->body([ 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()->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()->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')), 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()->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), amis()->SwitchControl('is_enable', __('admin.articles.is_enable'))->value(false),
@ -96,7 +96,7 @@ class ArticleController extends AdminController
])->md(4), ])->md(4),
amis()->Wrapper()->body([ amis()->Wrapper()->body([
Components::make()->fuEditorControl('content', __('admin.articles.content')), Components::make()->fuEditorControl('content', __('admin.articles.content')),
])->md(8) ])->md(8),
]), ]),
]); ]);
} }
@ -105,5 +105,4 @@ class ArticleController extends AdminController
{ {
return $this->baseDetail()->body([]); return $this->baseDetail()->body([]);
} }
} }

View File

@ -2,19 +2,19 @@
namespace App\Admin\Controllers; namespace App\Admin\Controllers;
use Slowlyo\OwlAdmin\Admin;
use Illuminate\Http\Request; 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\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 class AuthController extends AdminAuthController
{ {
public function login(Request $request) public function login(Request $request)
{ {
if (Admin::config('admin.auth.login_captcha')) { if (Admin::config('admin.auth.login_captcha')) {
if (!$request->has('captcha')) { if (! $request->has('captcha')) {
return $this->response()->fail(__('admin.required', ['attribute' => __('admin.captcha')])); return $this->response()->fail(__('admin.required', ['attribute' => __('admin.captcha')]));
} }
@ -28,8 +28,8 @@ class AuthController extends AdminAuthController
'username' => 'required', 'username' => 'required',
'password' => 'required', 'password' => 'required',
], [ ], [
'username' . '.required' => __('admin.required', ['attribute' => __('admin.username')]), 'username'.'.required' => __('admin.required', ['attribute' => __('admin.username')]),
'password.required' => __('admin.required', ['attribute' => __('admin.password')]), 'password.required' => __('admin.required', ['attribute' => __('admin.password')]),
]); ]);
if ($validator->fails()) { if ($validator->fails()) {
@ -37,15 +37,16 @@ class AuthController extends AdminAuthController
} }
$adminModel = Admin::adminUserModel(); $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, '您的账号已被锁定,需要联系超级管理员解锁。'); abort(Response::HTTP_BAD_REQUEST, '您的账号已被锁定,需要联系超级管理员解锁。');
}else{ } else {
if ($user && Hash::check($request->password, $user->password)) { if ($user && Hash::check($request->password, $user->password)) {
$module = Admin::currentModule(true); $module = Admin::currentModule(true);
$prefix = $module ? $module . '.' : ''; $prefix = $module ? $module.'.' : '';
$token = $user->createToken($prefix . 'admin')->plainTextToken; $token = $user->createToken($prefix.'admin')->plainTextToken;
return $this->response()->success(compact('token'), __('admin.login_successful')); return $this->response()->success(compact('token'), __('admin.login_successful'));
} }

View File

@ -3,17 +3,17 @@
namespace App\Admin\Controllers; namespace App\Admin\Controllers;
use Illuminate\Http\JsonResponse; 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 Illuminate\Http\Resources\Json\JsonResource;
use Slowlyo\OwlAdmin\Controllers\AdminController; 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 class HomeController extends AdminController
{ {
@ -47,7 +47,7 @@ class HomeController extends AdminController
return Card::make() return Card::make()
->className('h-full clear-card-mb') ->className('h-full clear-card-mb')
->body( ->body(
Custom::make()->html(<<<HTML Custom::make()->html(<<<'HTML'
<div class="h-full flex flex-col mt-5 py-5 px-7"> <div class="h-full flex flex-col mt-5 py-5 px-7">
<div></div> <div></div>
<div class="flex flex-1 items-center w-full justify-center" id="hitokoto"> <div class="flex flex-1 items-center w-full justify-center" id="hitokoto">
@ -64,12 +64,12 @@ class HomeController extends AdminController
</div> </div>
HTML HTML
)->onMount(<<<JS )->onMount(<<<'JS'
fetch('https://v1.hitokoto.cn?c=i') fetch('https://v1.hitokoto.cn?c=i')
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
const hitokoto = document.querySelector('#hitokoto_text') 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 hitokoto.innerText = data.hitokoto
document.querySelector('#hitokoto_from_who').innerText = data.from_who document.querySelector('#hitokoto_from_who').innerText = data.from_who
document.querySelector('#hitokoto_from').innerText = data.from document.querySelector('#hitokoto_from').innerText = data.from
@ -88,7 +88,7 @@ JS
Custom::make() Custom::make()
->name('clock') ->name('clock')
->html('<div id="clock" class="text-4xl"></div><div id="clock-date" class="mt-5"></div>') ->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 clock = document.getElementById('clock');
const tick = () => { const tick = () => {
clock.innerHTML = (new Date()).toLocaleTimeString(); clock.innerHTML = (new Date()).toLocaleTimeString();
@ -176,7 +176,8 @@ JS
for ($i = 0; $i < 7; $i++) { for ($i = 0; $i < 7; $i++) {
$_arr[] = random_int(10, 200); $_arr[] = random_int(10, 200);
} }
return '[' . implode(',', $_arr) . ']';
return '['.implode(',', $_arr).']';
}; };
$random1 = $randArr(); $random1 = $randArr();
@ -201,7 +202,7 @@ series: [
public function cube(): Card public function cube(): Card
{ {
return Card::make()->className('h-96 ml-4 w-8/12')->body( return Card::make()->className('h-96 ml-4 w-8/12')->body(
Html::make()->html(<<<HTML Html::make()->html(<<<'HTML'
<style> <style>
.cube-box{ height: 300px; display: flex; align-items: center; justify-content: center; } .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; } .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 private function css(): array
{ {
return [ return [
'.clear-card-mb' => [ '.clear-card-mb' => [
'margin-bottom' => '0 !important', 'margin-bottom' => '0 !important',
], ],
'.cxd-Image' => [ '.cxd-Image' => [
'border' => '0', 'border' => '0',
], ],
'.bg-blingbling' => [ '.bg-blingbling' => [
'color' => '#fff', 'color' => '#fff',
'background' => 'linear-gradient(to bottom right, #2C3E50, #FD746C, #FF8235, #ffff1c, #92FE9D, #00C9FF, #a044ff, #e73827)', 'background' => 'linear-gradient(to bottom right, #2C3E50, #FD746C, #FF8235, #ffff1c, #92FE9D, #00C9FF, #a044ff, #e73827)',
'background-repeat' => 'no-repeat', 'background-repeat' => 'no-repeat',
'background-size' => '1000% 1000%', 'background-size' => '1000% 1000%',
'animation' => 'gradient 60s ease infinite', 'animation' => 'gradient 60s ease infinite',
], ],
'@keyframes gradient' => [ '@keyframes gradient' => [
'0%{background-position:0% 0%} '0%{background-position:0% 0%}
50%{background-position:100% 100%} 50%{background-position:100% 100%}
100%{background-position:0% 0%}', 100%{background-position:0% 0%}',

View File

@ -44,7 +44,7 @@ class EmployeeController extends AdminController
->level('link') ->level('link')
->icon('fa fa-sign-out') ->icon('fa fa-sign-out')
->confirmText(__('employee.leave_confirm')) ->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()->TextControl()->name('phone')->label(__('employee.phone'))->required(),
amisMake()->TagControl()->name('jobs')->label(__('employee.jobs')) 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') ->labelField('name')
->valueField('key') ->valueField('key')
->joinValues(), ->joinValues(),
amisMake()->DateControl()->name('join_at')->label(__('employee.join_at'))->format('YYYY-MM-DD'), 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('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('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('confirm_password')->set('type', 'input-password')->label(__('admin.confirm_password'))->required(! $edit),
]); ]);
} }

View File

@ -2,11 +2,10 @@
namespace App\Admin\Controllers; namespace App\Admin\Controllers;
use Slowlyo\OwlAdmin\Controllers\AdminController;
use App\Traits\UploadTrait; use App\Traits\UploadTrait;
use Slowlyo\OwlAdmin\Controllers\AdminController;
class IndexController extends AdminController class IndexController extends AdminController
{ {
use UploadTrait; use UploadTrait;
}
}

View File

@ -33,8 +33,8 @@ class KeywordController extends AdminController
->placeholder(__('admin.keywords.search_name')), ->placeholder(__('admin.keywords.search_name')),
amis()->TextControl('parent_name', __('admin.keywords.parent_keyword')) amis()->TextControl('parent_name', __('admin.keywords.parent_keyword'))
->size('md') ->size('md')
->placeholder(__('admin.keywords.search_name')) ->placeholder(__('admin.keywords.search_name')),
] ]
)) ))
->columns([ ->columns([
// TableColumn::make()->name('id')->label('ID')->sortable(true), // 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('key')->label('KEY')->copyable(true),
TableColumn::make()->name('value')->label('值'), TableColumn::make()->name('value')->label('值'),
TableColumn::make()->name('sort')->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([ amisMake()->Operation()->label(__('admin.actions'))->buttons([
$this->rowEditButton(true), $this->rowEditButton(true),
$this->rowDeleteButton(), $this->rowDeleteButton(),
@ -63,7 +63,8 @@ class KeywordController extends AdminController
]); ]);
} }
public function getTreeList(Request $request){ public function getTreeList(Request $request)
return $this->service->getTree(); {
} return $this->service->getTree();
}
} }

View File

@ -2,14 +2,11 @@
namespace App\Admin\Controllers; namespace App\Admin\Controllers;
use Illuminate\Support\Arr;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Slowlyo\OwlAdmin\Controllers\AdminController;
use Slowlyo\OwlAdmin\Renderers\Tab; use Slowlyo\OwlAdmin\Renderers\Tab;
use Slowlyo\OwlAdmin\Renderers\Tabs; 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 class SettingController extends AdminController
{ {
@ -32,7 +29,7 @@ class SettingController extends AdminController
Tabs::make()->tabs([ Tabs::make()->tabs([
Tab::make()->title('上传设置')->body([ Tab::make()->title('上传设置')->body([
amis()->RadiosControl('upload_disk', '上传驱动')->options([ amis()->RadiosControl('upload_disk', '上传驱动')->options([
'public'=>'本地存储', 'public' => '本地存储',
'oss' => '阿里云OSS', 'oss' => '阿里云OSS',
])->value('public')->required(true), ])->value('public')->required(true),
amis()->TextControl('oss_config.access_key_id', '阿里云AccessKeyId')->required(true)->size('lg')->visibleOn('${upload_disk == "oss"}'), 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.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()->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"}'), amis()->SwitchControl('oss_config.use_ssl', '开启SSL')->value(false)->visibleOn('${upload_disk == "oss"}'),
]), ]),
]) ])
); );
} }
@ -50,41 +47,41 @@ class SettingController extends AdminController
{ {
$data = $request->only([ $data = $request->only([
'upload_disk', 'upload_disk',
'oss_config' 'oss_config',
]); ]);
//上传设置-修改env文件内配置 //上传设置-修改env文件内配置
if(!empty($data['upload_disk'])){ if (! empty($data['upload_disk'])) {
$envData['FILESYSTEM_DISK'] = $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_ID'] = Arr::get($data['oss_config'], 'access_key_id');
$envData['OSS_ACCESS_KEY_SECRET'] = Arr::get($data['oss_config'], 'access_key_secret'); $envData['OSS_ACCESS_KEY_SECRET'] = Arr::get($data['oss_config'], 'access_key_secret');
$envData['OSS_BUCKET'] = Arr::get($data['oss_config'], 'bucket'); $envData['OSS_BUCKET'] = Arr::get($data['oss_config'], 'bucket');
$envData['OSS_ENDPOINT'] = Arr::get($data['oss_config'], 'endpoint'); $envData['OSS_ENDPOINT'] = Arr::get($data['oss_config'], 'endpoint');
$envData['OSS_DOMAIN'] = Arr::get($data['oss_config'], 'domain'); $envData['OSS_DOMAIN'] = Arr::get($data['oss_config'], 'domain');
if(!empty($envData['OSS_DOMAIN'])){ if (! empty($envData['OSS_DOMAIN'])) {
$envData['OSS_CNAME'] = 'true'; $envData['OSS_CNAME'] = 'true';
}else{ } else {
$envData['OSS_CNAME'] = 'false'; $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 = collect(file($envPath, FILE_IGNORE_NEW_LINES));
$contentArray->transform(function ($item) use ($envData){ $contentArray->transform(function ($item) use ($envData) {
foreach ($envData as $key => $value){ foreach ($envData as $key => $value) {
if(str_contains($item, $key)){ if (str_contains($item, $key)) {
return $key . '=' . $value; return $key.'='.$value;
} }
} }
return $item; return $item;
}); });
$content = implode("\n", $contentArray->toArray()); $content = implode("\n", $contentArray->toArray());
\File::put($envPath, $content); \File::put($envPath, $content);
} }
return settings()->adminSetMany($data); return settings()->adminSetMany($data);
} }

View File

@ -45,7 +45,7 @@ class StoreController extends AdminController
->extractValue(false) ->extractValue(false)
->clearable(), ->clearable(),
amisMake()->SelectControl()->name('business_status')->label(__('store.business_status'))->columnRatio(3)->clearable(), amisMake()->SelectControl()->name('business_status')->label(__('store.business_status'))->columnRatio(3)->clearable(),
]) ]),
])) ]))
->columns([ ->columns([
amisMake()->TableColumn()->name('id')->label(__('store.id')), amisMake()->TableColumn()->name('id')->label(__('store.id')),
@ -62,6 +62,7 @@ class StoreController extends AdminController
$this->rowDeleteButton(), $this->rowDeleteButton(),
]), ]),
]); ]);
return $this->baseList($crud); return $this->baseList($crud);
} }

View File

@ -2,8 +2,8 @@
namespace App\Admin\Filters; namespace App\Admin\Filters;
use Illuminate\Support\Arr;
use EloquentFilter\ModelFilter; use EloquentFilter\ModelFilter;
use Illuminate\Support\Arr;
class AdFilter extends ModelFilter class AdFilter extends ModelFilter
{ {
@ -14,12 +14,13 @@ class AdFilter extends ModelFilter
{ {
return $this->where('id', $id); return $this->where('id', $id);
} }
/** /**
* 备注 * 备注
*/ */
public function remark($remark) 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); return $this->where('address', $address);
} }
public function publishedAt($publishedAt){
$publishedAt = explode(',',$publishedAt); public function publishedAt($publishedAt)
return $this->where(function($q) use ($publishedAt) { {
$publishedAt = explode(',', $publishedAt);
return $this->where(function ($q) use ($publishedAt) {
$startAt = Arr::get($publishedAt, 0) ?? null; $startAt = Arr::get($publishedAt, 0) ?? null;
$endAt = Arr::get($publishedAt, 1) ?? null; $endAt = Arr::get($publishedAt, 1) ?? null;
if(!empty($startAt)){ if (! empty($startAt)) {
$q->where('published_at', '>=', $startAt); $q->where('published_at', '>=', $startAt);
} }
if(!empty($endAt)){ if (! empty($endAt)) {
$q->where('published_at', '<=', $endAt); $q->where('published_at', '<=', $endAt);
} }
}); });
} }
public function createdAt($createdAt){ public function createdAt($createdAt)
$createdAt = explode(',',$createdAt); {
return $this->where(function($q) use ($createdAt) { $createdAt = explode(',', $createdAt);
return $this->where(function ($q) use ($createdAt) {
$startAt = Arr::get($createdAt, 0) ?? null; $startAt = Arr::get($createdAt, 0) ?? null;
$endAt = Arr::get($createdAt, 1) ?? null; $endAt = Arr::get($createdAt, 1) ?? null;
if(!empty($startAt)){ if (! empty($startAt)) {
$q->where('created_at', '>=', $startAt); $q->where('created_at', '>=', $startAt);
} }
if(!empty($endAt)){ if (! empty($endAt)) {
$q->where('created_at', '<=', $endAt); $q->where('created_at', '<=', $endAt);
} }
}); });
} }
public function enable($enable){ public function enable($enable)
{
return $this->where('is_enable', $enable); return $this->where('is_enable', $enable);
} }
} }

View File

@ -14,12 +14,13 @@ class ArticleFilter extends ModelFilter
{ {
return $this->where('id', $id); return $this->where('id', $id);
} }
/** /**
* 标题 * 标题
*/ */
public function title($title) 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){ public function tIds($tIds)
$tIds = explode(',',$tIds); {
return $this->where(function($q) use ($tIds) { $tIds = explode(',', $tIds);
return $this->where(function ($q) use ($tIds) {
foreach ($tIds as $tId) { foreach ($tIds as $tId) {
$q->whereRaw("FIND_IN_SET('".$tId."',t_ids)"); $q->whereRaw("FIND_IN_SET('".$tId."',t_ids)");
} }
}); });
} }
public function publishedAt($publishedAt){ public function publishedAt($publishedAt)
$publishedAt = explode(',',$publishedAt); {
return $this->where(function($q) use ($publishedAt) { $publishedAt = explode(',', $publishedAt);
return $this->where(function ($q) use ($publishedAt) {
$startAt = Arr::get($publishedAt, 0) ?? null; $startAt = Arr::get($publishedAt, 0) ?? null;
$endAt = Arr::get($publishedAt, 1) ?? null; $endAt = Arr::get($publishedAt, 1) ?? null;
if(!empty($startAt)){ if (! empty($startAt)) {
$q->where('published_at', '>=', $startAt); $q->where('published_at', '>=', $startAt);
} }
if(!empty($endAt)){ if (! empty($endAt)) {
$q->where('published_at', '<=', $endAt); $q->where('published_at', '<=', $endAt);
} }
}); });
} }
public function createdAt($createdAt){ public function createdAt($createdAt)
$createdAt = explode(',',$createdAt); {
return $this->where(function($q) use ($createdAt) { $createdAt = explode(',', $createdAt);
return $this->where(function ($q) use ($createdAt) {
$startAt = Arr::get($createdAt, 0) ?? null; $startAt = Arr::get($createdAt, 0) ?? null;
$endAt = Arr::get($createdAt, 1) ?? null; $endAt = Arr::get($createdAt, 1) ?? null;
if(!empty($startAt)){ if (! empty($startAt)) {
$q->where('created_at', '>=', $startAt); $q->where('created_at', '>=', $startAt);
} }
if(!empty($endAt)){ if (! empty($endAt)) {
$q->where('created_at', '<=', $endAt); $q->where('created_at', '<=', $endAt);
} }
}); });
} }
public function enable($enable){ public function enable($enable)
{
return $this->where('is_enable', $enable); return $this->where('is_enable', $enable);
} }
public function recommend($recommend){ public function recommend($recommend)
{
return $this->where('is_recommend', $recommend); return $this->where('is_recommend', $recommend);
} }
} }

View File

@ -9,7 +9,7 @@ class EmployeeFilter extends ModelFilter
public function search($key) public function search($key)
{ {
$condition = '%'.$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) public function name($key)

View File

@ -2,8 +2,8 @@
namespace App\Admin\Filters; namespace App\Admin\Filters;
use EloquentFilter\ModelFilter;
use App\Models\Keyword; use App\Models\Keyword;
use EloquentFilter\ModelFilter;
class KeywordFilter extends ModelFilter class KeywordFilter extends ModelFilter
{ {
@ -12,21 +12,22 @@ class KeywordFilter extends ModelFilter
*/ */
public function name($name) public function name($name)
{ {
return $this->where('name','like', '%'.$name.'%') return $this->where('name', 'like', '%'.$name.'%')
->orWhere('key','like', '%'.$name.'%'); ->orWhere('key', 'like', '%'.$name.'%');
} }
public function parentName($parent_name) public function parentName($parent_name)
{ {
if(request('has_owner', 1)){ if (request('has_owner', 1)) {
$this->where(function($q) use ($parent_name){ $this->where(function ($q) use ($parent_name) {
$q->where('name','like', '%'.$parent_name.'%') $q->where('name', 'like', '%'.$parent_name.'%')
->orWhere('key','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) public function parentKey($key)

View File

@ -12,7 +12,7 @@ class Menu
public function all() public function all()
{ {
$menus = $this->userMenus() $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') ->sortBy('order')
->values() ->values()
->toArray(); ->toArray();
@ -35,34 +35,35 @@ class Menu
if ($item['parent_id'] == $parentId) { if ($item['parent_id'] == $parentId) {
$idStr = "[{$item['id']}]"; $idStr = "[{$item['id']}]";
$_temp = [ $_temp = [
'name' => $parentName ? $parentName . '-' . $idStr : $idStr, 'name' => $parentName ? $parentName.'-'.$idStr : $idStr,
'path' => $item['url'], 'path' => $item['url'],
'component' => data_get($item, 'component') ?? 'amis', 'component' => data_get($item, 'component') ?? 'amis',
'is_home' => $item['is_home'], 'is_home' => $item['is_home'],
'is_full' => $item['is_full'] ?? 0, 'is_full' => $item['is_full'] ?? 0,
'is_link' => $item['url_type'] == Admin::adminMenuModel()::TYPE_LINK, 'is_link' => $item['url_type'] == Admin::adminMenuModel()::TYPE_LINK,
'meta' => [ 'meta' => [
'title' => $item['title'], 'title' => $item['title'],
'icon' => $item['icon'] ?? '-', 'icon' => $item['icon'] ?? '-',
'hide' => $item['visible'] == 0, 'hide' => $item['visible'] == 0,
'order' => $item['order'], '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['component'] = 'amis';
$_temp['children'] = $children; $_temp['children'] = $children;
} }
$data[] = $_temp; $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)); array_push($data, ...$this->generateRoute($_temp));
} }
unset($list[$key]); unset($list[$key]);
} }
} }
return $data; return $data;
} }
@ -71,18 +72,18 @@ class Menu
$url = $item['path'] ?? ''; $url = $item['path'] ?? '';
$url = preg_replace('/\?.*/', '', $url); $url = preg_replace('/\?.*/', '', $url);
if (!$url || array_key_exists('children', $item)) { if (! $url || array_key_exists('children', $item)) {
return []; return [];
} }
$menu = fn($action, $path) => [ $menu = fn ($action, $path) => [
'name' => $item['name'] . '-' . $action, 'name' => $item['name'].'-'.$action,
'path' => $url . $path, 'path' => $url.$path,
'component' => 'amis', 'component' => 'amis',
'meta' => [ 'meta' => [
'hide' => true, 'hide' => true,
'icon' => Arr::get($item, 'meta.icon'), 'icon' => Arr::get($item, 'meta.icon'),
'title' => Arr::get($item, 'meta.title') . ' - ' . __('admin.' . $action), 'title' => Arr::get($item, 'meta.title').' - '.__('admin.'.$action),
], ],
]; ];
@ -103,15 +104,15 @@ class Menu
private function formatItem($item) private function formatItem($item)
{ {
return array_merge([ return array_merge([
'title' => '', 'title' => '',
'url' => '', 'url' => '',
'url_type' => 1, 'url_type' => 1,
'icon' => '', 'icon' => '',
'parent_id' => 0, 'parent_id' => 0,
'id' => 999, 'id' => 999,
'is_home' => 0, 'is_home' => 0,
'visible' => 1, 'visible' => 1,
'order' => 99, 'order' => 99,
], $item); ], $item);
} }
@ -124,13 +125,13 @@ class Menu
{ {
$extraMenus = [ $extraMenus = [
[ [
'name' => 'user_setting', 'name' => 'user_setting',
'path' => '/user_setting', 'path' => '/user_setting',
'component' => 'amis', 'component' => 'amis',
'meta' => [ 'meta' => [
'hide' => true, 'hide' => true,
'title' => __('admin.user_setting'), 'title' => __('admin.user_setting'),
'icon' => 'material-symbols:manage-accounts', 'icon' => 'material-symbols:manage-accounts',
'singleLayout' => 'basic', 'singleLayout' => 'basic',
], ],
], ],
@ -152,39 +153,39 @@ class Menu
{ {
return [ return [
[ [
'name' => 'dev_tools', 'name' => 'dev_tools',
'path' => '/dev_tools', 'path' => '/dev_tools',
'component' => 'amis', 'component' => 'amis',
'meta' => [ 'meta' => [
'title' => __('admin.developer'), 'title' => __('admin.developer'),
'icon' => 'fluent:window-dev-tools-20-regular', 'icon' => 'fluent:window-dev-tools-20-regular',
], ],
'children' => [ 'children' => [
[ [
'name' => 'dev_tools_extensions', 'name' => 'dev_tools_extensions',
'path' => '/dev_tools/extensions', 'path' => '/dev_tools/extensions',
'component' => 'amis', 'component' => 'amis',
'meta' => [ 'meta' => [
'title' => __('admin.extensions.menu'), 'title' => __('admin.extensions.menu'),
'icon' => 'ion:extension-puzzle-outline', 'icon' => 'ion:extension-puzzle-outline',
], ],
], ],
[ [
'name' => 'dev_tools_code_generator', 'name' => 'dev_tools_code_generator',
'path' => '/dev_tools/code_generator', 'path' => '/dev_tools/code_generator',
'component' => 'amis', 'component' => 'amis',
'meta' => [ 'meta' => [
'title' => __('admin.code_generator'), 'title' => __('admin.code_generator'),
'icon' => 'ic:baseline-code', 'icon' => 'ic:baseline-code',
], ],
], ],
[ [
'name' => 'dev_tools_editor', 'name' => 'dev_tools_editor',
'path' => '/dev_tools/editor', 'path' => '/dev_tools/editor',
'component' => 'editor', 'component' => 'editor',
'meta' => [ 'meta' => [
'title' => __('admin.visual_editor'), 'title' => __('admin.visual_editor'),
'icon' => 'mdi:monitor-edit', 'icon' => 'mdi:monitor-edit',
], ],
], ],
], ],

View File

@ -24,7 +24,7 @@ class AdService extends BaseService
public function store($data): bool public function store($data): bool
{ {
$columns = $this->getTableColumns(); $columns = $this->getTableColumns();
$model = $this->getModel(); $model = $this->getModel();
$isEnable = Arr::get($data, 'is_enabled'); $isEnable = Arr::get($data, 'is_enabled');
$publishedAt = Arr::get($data, 'published_at'); $publishedAt = Arr::get($data, 'published_at');
@ -32,14 +32,14 @@ class AdService extends BaseService
$data['published_at'] = now(); $data['published_at'] = now();
} }
if(isset($data['resource'])){ if (isset($data['resource'])) {
$data['resource'] = $this->saveImage('resource', 'ads/resource')[0]; $data['resource'] = $this->saveImage('resource', 'ads/resource')[0];
} }
//处理跳转配置 //处理跳转配置
$jumpType = Arr::get($data, 'jump_type'); $jumpType = Arr::get($data, 'jump_type');
if($jumpType !== null){ if ($jumpType !== null) {
switch($jumpType){ switch ($jumpType) {
case Ad::TYPE_OFF: case Ad::TYPE_OFF:
$data['jump_config'] = null; $data['jump_config'] = null;
break; break;
@ -47,16 +47,16 @@ class AdService extends BaseService
$data['jump_config'] = Arr::only($data['jump_config'], 'web_link'); $data['jump_config'] = Arr::only($data['jump_config'], 'web_link');
break; break;
case Ad::TYPE_APP: 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; break;
case Ad::TYPE_MINI: 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; break;
} }
} }
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if (!in_array($k, $columns)) { if (! in_array($k, $columns)) {
continue; continue;
} }
@ -69,7 +69,7 @@ class AdService extends BaseService
public function update($primaryKey, $data): bool public function update($primaryKey, $data): bool
{ {
$columns = $this->getTableColumns(); $columns = $this->getTableColumns();
$model = $this->query()->whereKey($primaryKey)->first(); $model = $this->query()->whereKey($primaryKey)->first();
$isEnable = Arr::get($data, 'is_enable'); $isEnable = Arr::get($data, 'is_enable');
$publishedAt = Arr::get($data, 'published_at'); $publishedAt = Arr::get($data, 'published_at');
@ -78,14 +78,14 @@ class AdService extends BaseService
$data['published_at'] = now(); $data['published_at'] = now();
} }
if(isset($data['resource'])){ if (isset($data['resource'])) {
$data['resource'] = $this->saveImage('resource', 'ads/resource')[0]; $data['resource'] = $this->saveImage('resource', 'ads/resource')[0];
} }
//处理跳转配置 //处理跳转配置
$jumpType = Arr::get($data, 'jump_type'); $jumpType = Arr::get($data, 'jump_type');
if($jumpType !== null){ if ($jumpType !== null) {
switch($jumpType){ switch ($jumpType) {
case Ad::TYPE_OFF: case Ad::TYPE_OFF:
$data['jump_config'] = null; $data['jump_config'] = null;
break; break;
@ -93,16 +93,16 @@ class AdService extends BaseService
$data['jump_config'] = Arr::only($data['jump_config'], 'web_link'); $data['jump_config'] = Arr::only($data['jump_config'], 'web_link');
break; break;
case Ad::TYPE_APP: 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; break;
case Ad::TYPE_MINI: 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; break;
} }
} }
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if (!in_array($k, $columns)) { if (! in_array($k, $columns)) {
continue; continue;
} }

View File

@ -2,12 +2,12 @@
namespace App\Admin\Services; 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\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() * @method AdminUser getModel()
@ -37,11 +37,11 @@ class AdminUserService extends BaseService
return $this->setError(__('admin.admin_user.username_already_exists')); 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')])); return $this->setError(__('admin.required', ['attribute' => __('admin.password')]));
} }
if (!$this->passwordHandler($data)) { if (! $this->passwordHandler($data)) {
return false; return false;
} }
@ -58,7 +58,7 @@ class AdminUserService extends BaseService
return $this->setError(__('admin.admin_user.username_already_exists')); return $this->setError(__('admin.admin_user.username_already_exists'));
} }
if (!$this->passwordHandler($data)) { if (! $this->passwordHandler($data)) {
return false; return false;
} }
@ -73,13 +73,13 @@ class AdminUserService extends BaseService
{ {
return $this->query() return $this->query()
->where('username', $username) ->where('username', $username)
->when($id, fn($query) => $query->where('id', '<>', $id)) ->when($id, fn ($query) => $query->where('id', '<>', $id))
->exists(); ->exists();
} }
public function updateUserSetting($primaryKey, $data): bool public function updateUserSetting($primaryKey, $data): bool
{ {
if (!$this->passwordHandler($data, $primaryKey)) { if (! $this->passwordHandler($data, $primaryKey)) {
return false; return false;
} }
@ -96,13 +96,13 @@ class AdminUserService extends BaseService
} }
if ($id) { if ($id) {
if (!Arr::get($data, 'old_password')) { if (! Arr::get($data, 'old_password')) {
return $this->setError(__('admin.admin_user.old_password_required')); return $this->setError(__('admin.admin_user.old_password_required'));
} }
$oldPassword = $this->query()->where('id', $id)->value('password'); $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')); return $this->setError(__('admin.admin_user.old_password_error'));
} }
} }
@ -136,19 +136,12 @@ class AdminUserService extends BaseService
return compact('items', 'total'); return compact('items', 'total');
} }
/**
* @param $data
* @param array $columns
* @param AdminUser $model
*
* @return bool
*/
protected function saveData($data, array $columns, AdminUser $model): bool protected function saveData($data, array $columns, AdminUser $model): bool
{ {
$roles = Arr::pull($data, 'roles'); $roles = Arr::pull($data, 'roles');
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if (!in_array($k, $columns)) { if (! in_array($k, $columns)) {
continue; continue;
} }

View File

@ -24,7 +24,7 @@ class ArticleService extends BaseService
public function store($data): bool public function store($data): bool
{ {
$columns = $this->getTableColumns(); $columns = $this->getTableColumns();
$model = $this->getModel(); $model = $this->getModel();
$isEnable = Arr::get($data, 'is_enabled'); $isEnable = Arr::get($data, 'is_enabled');
$publishedAt = Arr::get($data, 'published_at'); $publishedAt = Arr::get($data, 'published_at');
@ -36,7 +36,7 @@ class ArticleService extends BaseService
$data['appendixes'] = $this->saveFile('appendixes', 'articles/appendixes'); $data['appendixes'] = $this->saveFile('appendixes', 'articles/appendixes');
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if (!in_array($k, $columns)) { if (! in_array($k, $columns)) {
continue; continue;
} }
@ -49,7 +49,7 @@ class ArticleService extends BaseService
public function update($primaryKey, $data): bool public function update($primaryKey, $data): bool
{ {
$columns = $this->getTableColumns(); $columns = $this->getTableColumns();
$model = $this->query()->whereKey($primaryKey)->first(); $model = $this->query()->whereKey($primaryKey)->first();
$isEnable = Arr::get($data, 'is_enable'); $isEnable = Arr::get($data, 'is_enable');
$publishedAt = Arr::get($data, 'published_at'); $publishedAt = Arr::get($data, 'published_at');
@ -58,16 +58,16 @@ class ArticleService extends BaseService
$data['published_at'] = now(); $data['published_at'] = now();
} }
if(isset($data['cover'])){ if (isset($data['cover'])) {
$data['cover'] = $this->saveImage('cover', 'articles/cover')[0] ?? ''; $data['cover'] = $this->saveImage('cover', 'articles/cover')[0] ?? '';
} }
if(isset($data['appendixes'])){ if (isset($data['appendixes'])) {
$data['appendixes'] = $this->saveFile('appendixes', 'articles/appendixes'); $data['appendixes'] = $this->saveFile('appendixes', 'articles/appendixes');
} }
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if (!in_array($k, $columns)) { if (! in_array($k, $columns)) {
continue; continue;
} }

View File

@ -20,6 +20,7 @@ class BaseService extends AdminService
{ {
$list = $this->query()->orderByDesc('sort')->get(); $list = $this->query()->orderByDesc('sort')->get();
$minNum = $list->min('parent_id'); $minNum = $list->min('parent_id');
return array2tree($list->toArray(), $minNum); return array2tree($list->toArray(), $minNum);
} }
@ -34,7 +35,7 @@ class BaseService extends AdminService
$filter = $this->getModelFilter(); $filter = $this->getModelFilter();
$query = $this->query(); $query = $this->query();
if($this->withRelationships){ if ($this->withRelationships) {
$query->with($this->withRelationships); $query->with($this->withRelationships);
} }
@ -42,7 +43,7 @@ class BaseService extends AdminService
$query->filter(request()->input(), $filter); $query->filter(request()->input(), $filter);
} }
if($this->modelSortAble){ if ($this->modelSortAble) {
$query->sort(); $query->sort();
} }
@ -63,6 +64,7 @@ class BaseService extends AdminService
$validate = $this->validate($data); $validate = $this->validate($data);
if ($validate !== true) { if ($validate !== true) {
$this->setError($validate); $this->setError($validate);
return false; return false;
} }
@ -78,6 +80,7 @@ class BaseService extends AdminService
$validate = $this->validate($data, $model); $validate = $this->validate($data, $model);
if ($validate !== true) { if ($validate !== true) {
$this->setError($validate); $this->setError($validate);
return false; return false;
} }
@ -90,16 +93,18 @@ class BaseService extends AdminService
$result = $this->preDelete($id); $result = $this->preDelete($id);
if ($result !== true) { if ($result !== true) {
$this->setError($result); $this->setError($result);
return false; return false;
} }
return $this->query()->whereIn($this->primaryKey(), $id)->delete(); return $this->query()->whereIn($this->primaryKey(), $id)->delete();
} }
/** /**
* 处理表单数据 * 处理表单数据
* *
* @param array $data * @param array $data
* @param Model $model : 添加, 非空: 修改 * @param Model $model : 添加, 非空: 修改
* @return array * @return array
*/ */
public function resloveData($data, $model = null) public function resloveData($data, $model = null)
@ -110,8 +115,8 @@ class BaseService extends AdminService
/** /**
* 表单验证 * 表单验证
* *
* @param array $data * @param array $data
* @param Model $model : 添加, 非空: 修改 * @param Model $model : 添加, 非空: 修改
* @return mixed true: 验证通过, string: 错误提示 * @return mixed true: 验证通过, string: 错误提示
*/ */
public function validate($data, $model = null) 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: 中断操作, 返回错误提示 * @return mixed true: 继续后续操作, string: 中断操作, 返回错误提示
*/ */
public function preDelete(array $ids) public function preDelete(array $ids)

View File

@ -4,12 +4,12 @@ namespace App\Admin\Services;
use App\Admin\Filters\EmployeeFilter; use App\Admin\Filters\EmployeeFilter;
use App\Models\Employee; 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\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 class EmployeeService extends BaseService
{ {
@ -26,6 +26,7 @@ class EmployeeService extends BaseService
$validate = $this->validate($data); $validate = $this->validate($data);
if ($validate !== true) { if ($validate !== true) {
$this->setError($validate); $this->setError($validate);
return false; return false;
} }
@ -45,6 +46,7 @@ class EmployeeService extends BaseService
$validate = $this->validate($data, $model); $validate = $this->validate($data, $model);
if ($validate !== true) { if ($validate !== true) {
$this->setError($validate); $this->setError($validate);
return false; return false;
} }
@ -60,7 +62,7 @@ class EmployeeService extends BaseService
$model = $this->getModel(); $model = $this->getModel();
$hidden = collect([$model->getCreatedAtColumn(), $model->getUpdatedAtColumn()]) $hidden = collect([$model->getCreatedAtColumn(), $model->getUpdatedAtColumn()])
->filter(fn($item) => $item !== null) ->filter(fn ($item) => $item !== null)
->toArray(); ->toArray();
return $this->query()->with(['adminUser', 'jobs'])->find($id)->makeHidden($hidden); return $this->query()->with(['adminUser', 'jobs'])->find($id)->makeHidden($hidden);
@ -73,28 +75,31 @@ class EmployeeService extends BaseService
if ($model) { if ($model) {
// 修改管理员信息 // 修改管理员信息
if (Arr::hasAny($data, ['username', 'password', 'confirm_password'])) { 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()); $this->setError($adminUserService->getError());
return false; return false;
} }
} }
} else { } 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()); $this->setError($adminUserService->getError());
return false; return false;
} }
$adminUser = AdminUser::where('username', $data['username'])->first(); $adminUser = AdminUser::where('username', $data['username'])->first();
$data['admin_user_id'] = $adminUser->id; $data['admin_user_id'] = $adminUser->id;
} }
return $data; return $data;
} }
/** /**
* 处理职位关联 * 处理职位关联
* *
* @param Employee $model * @param Employee $model
* @param array $jobs(字典表 key 组成的数组) * @param array $jobs(字典表 key 组成的数组)
*/ */
public function resloveJob($model, $jobs) public function resloveJob($model, $jobs)
{ {
@ -107,6 +112,7 @@ class EmployeeService extends BaseService
$adminUserIds = Employee::whereIn('id', $ids)->pluck('admin_user_id')->implode(','); $adminUserIds = Employee::whereIn('id', $ids)->pluck('admin_user_id')->implode(',');
$adminUserService = AdminUserService::make(); $adminUserService = AdminUserService::make();
$adminUserService->delete($adminUserIds); $adminUserService->delete($adminUserIds);
return true; return true;
} }
@ -118,12 +124,13 @@ class EmployeeService extends BaseService
]; ];
$updateRules = []; $updateRules = [];
$validator = Validator::make($data, $model ? $updateRules : $createRules, [ $validator = Validator::make($data, $model ? $updateRules : $createRules, [
'name.required' => __('employee.name') . '必填', 'name.required' => __('employee.name').'必填',
'phone.required' => __('employee.phone') . '必填', 'phone.required' => __('employee.phone').'必填',
]); ]);
if ($validator->fails()) { if ($validator->fails()) {
return $validator->errors()->first(); return $validator->errors()->first();
} }
return true; return true;
} }
} }

View File

@ -13,13 +13,15 @@ use Illuminate\Support\Arr;
class KeywordService extends BaseService class KeywordService extends BaseService
{ {
protected string $modelName = Keyword::class; protected string $modelName = Keyword::class;
protected string $modelFilterName = KeywordFilter::class; protected string $modelFilterName = KeywordFilter::class;
public function getTree() public function getTree()
{ {
$list = $this->query()->filter(request()->all(), $this->modelFilterName)->get(); $list = $this->query()->filter(request()->all(), $this->modelFilterName)->get();
$minNum = $list->min('parent_id'); $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 public function parentIsChild($id, $pid): bool
@ -53,7 +55,7 @@ class KeywordService extends BaseService
$model = $this->getModel(); $model = $this->getModel();
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if (!in_array($k, $columns)) { if (! in_array($k, $columns)) {
continue; continue;
} }
@ -75,6 +77,7 @@ class KeywordService extends BaseService
if ($pid != 0) { if ($pid != 0) {
if ($this->parentIsChild($primaryKey, $pid)) { if ($this->parentIsChild($primaryKey, $pid)) {
$this->setError('父级不允许设置为当前子权限'); $this->setError('父级不允许设置为当前子权限');
return false; return false;
} }
} }
@ -82,7 +85,7 @@ class KeywordService extends BaseService
$model = $this->query()->whereKey($primaryKey)->first(); $model = $this->query()->whereKey($primaryKey)->first();
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if (!in_array($k, $columns)) { if (! in_array($k, $columns)) {
continue; continue;
} }
@ -94,10 +97,11 @@ class KeywordService extends BaseService
public function hasRepeated($data, $id = 0): bool 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()) { if ((clone $query)->where('key', $data['key'])->exists()) {
$this->setError('KEY重复'); $this->setError('KEY重复');
return true; return true;
} }
@ -107,7 +111,7 @@ class KeywordService extends BaseService
public function delete(string $ids): mixed public function delete(string $ids): mixed
{ {
$ids = explode(',', $ids); $ids = explode(',', $ids);
if(count($ids) == 1){ if (count($ids) == 1) {
$this->query()->where('path', 'like', '%-'.$ids[0].'-%')->delete(); $this->query()->where('path', 'like', '%-'.$ids[0].'-%')->delete();
} }

View File

@ -3,8 +3,8 @@
namespace App\Admin\Services; namespace App\Admin\Services;
use App\Admin\Filters\StoreFilter; use App\Admin\Filters\StoreFilter;
use App\Models\Store;
use App\Enums\StoreRole; use App\Enums\StoreRole;
use App\Models\Store;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
@ -23,6 +23,7 @@ class StoreService extends BaseService
$validate = $this->validate($data); $validate = $this->validate($data);
if ($validate !== true) { if ($validate !== true) {
$this->setError($validate); $this->setError($validate);
return false; return false;
} }
@ -41,6 +42,7 @@ class StoreService extends BaseService
$validate = $this->validate($data, $model); $validate = $this->validate($data, $model);
if ($validate !== true) { if ($validate !== true) {
$this->setError($validate); $this->setError($validate);
return false; return false;
} }
@ -59,6 +61,7 @@ class StoreService extends BaseService
$data['lon'] = data_get($data['location'], 'lng'); $data['lon'] = data_get($data['location'], 'lng');
$data['lat'] = data_get($data['location'], 'lat'); $data['lat'] = data_get($data['location'], 'lat');
} }
return $data; return $data;
} }
@ -75,7 +78,7 @@ class StoreService extends BaseService
'lat' => ['required'], 'lat' => ['required'],
]; ];
$updateRules = [ $updateRules = [
'master_id' => [Rule::unique($model, 'master_id')] 'master_id' => [Rule::unique($model, 'master_id')],
]; ];
$validator = Validator::make($data, $model ? $updateRules : $createRules, [ $validator = Validator::make($data, $model ? $updateRules : $createRules, [
'master_id.unique' => '已经是店长了', 'master_id.unique' => '已经是店长了',
@ -83,6 +86,7 @@ class StoreService extends BaseService
if ($validator->fails()) { if ($validator->fails()) {
return $validator->errors()->first(); return $validator->errors()->first();
} }
return true; return true;
} }
} }

View File

@ -6,4 +6,4 @@ use Slowlyo\OwlAdmin\Admin;
// '.cxd-Panel-heading { border-width: 0; background: #4080ffc7 !important; }', // '.cxd-Panel-heading { border-width: 0; background: #4080ffc7 !important; }',
// // '.cxd-Panel {box-shadow: none; }', // // '.cxd-Panel {box-shadow: none; }',
// '.cxd-Panel-title { color:white;font-size: 16px; }' // '.cxd-Panel-title { color:white;font-size: 16px; }'
// ]); // ]);

View File

@ -1,15 +1,15 @@
<?php <?php
namespace App\Casts; 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\Contracts\Database\Eloquent\CastsAttributes;
use Illuminate\Support\Facades\Storage as StorageFacades;
use Illuminate\Support\Str;
use Slowlyo\OwlAdmin\Admin;
/** /**
* 转换文件存储路径 * 转换文件存储路径
* *
* get: 返回全路径 * get: 返回全路径
* set: 原样保存 * 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)) : ''; return $value ? (Str::startsWith($value, ['http://', 'https://']) ? $value : StorageFacades::disk(Admin::config('admin.upload.disk'))->url($value)) : '';
} }
/** /**
* Prepare the given value for storage. * Prepare the given value for storage.
* *
@ -42,4 +42,4 @@ class Storage implements CastsAttributes
{ {
return $value; return $value;
} }
} }

View File

@ -32,6 +32,7 @@ enum BusinessStatus: int
foreach (self::map() as $key => $value) { foreach (self::map() as $key => $value) {
array_push($list, ['label' => $value, 'value' => $key]); array_push($list, ['label' => $value, 'value' => $key]);
} }
return $list; return $list;
} }

View File

@ -32,6 +32,7 @@ enum EmployeeStatus: int
foreach (self::map() as $key => $value) { foreach (self::map() as $key => $value) {
array_push($list, ['label' => $value, 'value' => $key]); array_push($list, ['label' => $value, 'value' => $key]);
} }
return $list; return $list;
} }

View File

@ -24,6 +24,7 @@ enum StoreRole: int
foreach (self::map() as $key => $value) { foreach (self::map() as $key => $value) {
array_push($list, ['label' => $value, 'value' => $key]); array_push($list, ['label' => $value, 'value' => $key]);
} }
return $list; return $list;
} }

View File

@ -2,20 +2,22 @@
namespace App\Models; namespace App\Models;
use EloquentFilter\Filterable;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use EloquentFilter\Filterable;
use App\Casts\Storage;
class Ad extends Model class Ad extends Model
{ {
use HasFactory;
use Filterable; use Filterable;
use HasFactory;
public const TYPE_OFF = 0; //无跳转 public const TYPE_OFF = 0; //无跳转
public const TYPE_WEB = 1; //网页跳转 public const TYPE_WEB = 1; //网页跳转
public const TYPE_APP = 2; //应用跳转 public const TYPE_APP = 2; //应用跳转
public const TYPE_MINI = 3;//小程序跳转
public const TYPE_MINI = 3; //小程序跳转
protected function serializeDate(\DateTimeInterface $date) protected function serializeDate(\DateTimeInterface $date)
{ {
@ -41,7 +43,7 @@ class Ad extends Model
'jump_config', 'jump_config',
]; ];
public static function jumpTypeMap() :array public static function jumpTypeMap(): array
{ {
return [ return [
self::TYPE_WEB => '网页跳转', self::TYPE_WEB => '网页跳转',
@ -58,7 +60,7 @@ class Ad extends Model
self::TYPE_WEB => "<span class='label label-info'>网页跳转</span>", self::TYPE_WEB => "<span class='label label-info'>网页跳转</span>",
self::TYPE_APP => "<span class='label label-warning'>应用跳转</span>", self::TYPE_APP => "<span class='label label-warning'>应用跳转</span>",
self::TYPE_MINI => "<span class='label label-green'>小程序跳转</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_IN => "<span class='label label-info'>入住缴费</span>",
self::TYPE_CONTINUE => "<span class='label label-warning'>续住缴费</span>", self::TYPE_CONTINUE => "<span class='label label-warning'>续住缴费</span>",
self::TYPE_EXIT => "<span class='label label-danger'>离开结算</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()); $q->where('is_enable', true)->where('published_at', '>=', now());
} }
public function scopeSort($q) public function scopeSort($q)
{ {
$q->orderBy('sort', 'asc') $q->orderBy('sort', 'asc')
->orderBy('published_at', 'desc') ->orderBy('published_at', 'desc')
->orderBy('created_at', 'desc'); ->orderBy('created_at', 'desc');
} }
} }

View File

@ -46,7 +46,7 @@ class AdminUser extends Model
} }
$parent = $allMenus->get($parent->parent_id); $parent = $allMenus->get($parent->parent_id);
}; }
} }
unset($allMenus, $roleMenus); unset($allMenus, $roleMenus);

View File

@ -2,16 +2,15 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use EloquentFilter\Filterable; 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 class Article extends Model
{ {
use HasFactory;
use Filterable; use Filterable;
use HasFactory;
protected function serializeDate(\DateTimeInterface $date) protected function serializeDate(\DateTimeInterface $date)
{ {
@ -42,7 +41,8 @@ class Article extends Model
'appendixes', 'appendixes',
]; ];
public function scopeShow(){ public function scopeShow()
{
$q->where('is_enable', true)->where('published_at', '>=', now()); $q->where('is_enable', true)->where('published_at', '>=', now());
} }
@ -54,10 +54,10 @@ class Article extends Model
->orderBy('created_at', 'desc'); ->orderBy('created_at', 'desc');
} }
protected function tags():Attribute protected function tags(): Attribute
{ {
return Attribute::make( return Attribute::make(
get: fn($value) => $this->t_ids ? explode(',', $this->t_ids) : [], get: fn ($value) => $this->t_ids ? explode(',', $this->t_ids) : [],
); );
} }
} }

View File

@ -2,12 +2,12 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Enums\EmployeeStatus; use App\Enums\EmployeeStatus;
use Slowlyo\OwlAdmin\Models\AdminUser;
use Illuminate\Database\Eloquent\Casts\Attribute;
use EloquentFilter\Filterable;
use App\Traits\HasDateTimeFormatter; use App\Traits\HasDateTimeFormatter;
use EloquentFilter\Filterable;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Slowlyo\OwlAdmin\Models\AdminUser;
/** /**
* 员工 * 员工

View File

@ -11,8 +11,8 @@ use Illuminate\Support\Str;
class Keyword extends Model class Keyword extends Model
{ {
use HasFactory;
use Filterable; use Filterable;
use HasFactory;
protected $fillable = ['name', 'key', 'value', 'parent_id', 'parent_key', 'path', 'sort', 'lv']; protected $fillable = ['name', 'key', 'value', 'parent_id', 'parent_key', 'path', 'sort', 'lv'];
@ -33,7 +33,7 @@ class Keyword extends Model
'lv' => 1, 'lv' => 1,
]); ]);
if((string) $keyword->key === ''){ if ((string) $keyword->key === '') {
$keyword->key = Str::random(16); $keyword->key = Str::random(16);
} }
} else { } else {
@ -43,8 +43,8 @@ class Keyword extends Model
'lv' => $parent->lv + 1, 'lv' => $parent->lv + 1,
]); ]);
if((string) $keyword->key === ''){ if ((string) $keyword->key === '') {
$keyword->key = $parent->key . '_' . ($parent->children()->count() + 1); $keyword->key = $parent->key.'_'.($parent->children()->count() + 1);
} }
} }
}); });
@ -62,17 +62,18 @@ class Keyword extends Model
public function scopeAllChildrenOfKey($q, $parentKey) public function scopeAllChildrenOfKey($q, $parentKey)
{ {
$q->where('path','like', '%-'. $q->where('path', 'like', '%-'.
static::where('key', $parentKey)->value('id') static::where('key', $parentKey)->value('id')
. '-%' ?? ''); .'-%' ?? '');
} }
public static function tagsMap(String $key) public static function tagsMap(string $key)
{ {
$mapArr = []; $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); $mapArr[$item->id] = Components::make()->keywordsTag($item->name, $item->value);
}); });
return $mapArr; return $mapArr;
} }

View File

@ -2,11 +2,11 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Enums\BusinessStatus; use App\Enums\BusinessStatus;
use Illuminate\Database\Eloquent\Casts\Attribute;
use EloquentFilter\Filterable;
use App\Traits\HasDateTimeFormatter; use App\Traits\HasDateTimeFormatter;
use EloquentFilter\Filterable;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
/** /**
* 门店 * 门店

View File

@ -35,10 +35,6 @@ class QueryLoggerServiceProvider extends ServiceProvider
}); });
} }
/**
* @param \Illuminate\Database\Events\QueryExecuted $query
* @return string
*/
protected function prepareSql(QueryExecuted $query): string protected function prepareSql(QueryExecuted $query): string
{ {
$sql = str_replace(['%', '?'], ['%%', '%s'], $query->sql); $sql = str_replace(['%', '?'], ['%%', '%s'], $query->sql);
@ -54,7 +50,6 @@ class QueryLoggerServiceProvider extends ServiceProvider
/** /**
* @param float $milliseconds * @param float $milliseconds
* @return string
*/ */
protected function formatDuration($milliseconds): string protected function formatDuration($milliseconds): string
{ {

View File

@ -2,23 +2,16 @@
namespace App\Traits; namespace App\Traits;
use Slowlyo\OwlAdmin\Admin;
use Slowlyo\OwlAdmin\Renderers\Drawer;
use Slowlyo\OwlAdmin\Renderers\Dialog; use Slowlyo\OwlAdmin\Renderers\Dialog;
use Slowlyo\OwlAdmin\Renderers\DrawerAction;
use Slowlyo\OwlAdmin\Renderers\DialogAction; use Slowlyo\OwlAdmin\Renderers\DialogAction;
use Slowlyo\OwlAdmin\Renderers\Drawer;
use Slowlyo\OwlAdmin\Renderers\DrawerAction;
use Slowlyo\OwlAdmin\Renderers\LinkAction; use Slowlyo\OwlAdmin\Renderers\LinkAction;
trait CustomActionTrait 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 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([]); $form = $this->form(false)->api($this->getStorePath())->onEvent([]);
$drawer = Drawer::make()->title(__('admin.create'))->body($form)->closeOnOutside(); $drawer = Drawer::make()->title(__('admin.create'))->body($form)->closeOnOutside();
if($width){ if ($width) {
$drawer->width($width); $drawer->width($width);
}else{ } else {
$drawer->size($size); $drawer->size($size);
} }
$button = DrawerAction::make()->drawer($drawer); $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 protected function rowEditTypeButton(string $type = '', string $size = '', string $width = ''): DialogAction|DrawerAction|LinkAction
{ {
switch ($type) { switch ($type) {
case 'drawer': case 'drawer':
$form = $this->form(true) $form = $this->form(true)
->api($this->getUpdatePath()) ->api($this->getUpdatePath())
->initApi($this->getEditGetDataPath()) ->initApi($this->getEditGetDataPath())
->redirect('') ->redirect('')
->onEvent([]); ->onEvent([]);
$drawer = Drawer::make()->title(__('admin.edit'))->body($form)->closeOnOutside(); $drawer = Drawer::make()->title(__('admin.edit'))->body($form)->closeOnOutside();
if($width){ if ($width) {
$drawer->width($width); $drawer->width($width);
}else{ } else {
$drawer->size($size); $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 protected function rowShowTypeButton(string $type = '', string $size = '', string $width = ''): DialogAction|DrawerAction|LinkAction
{ {
@ -112,15 +93,15 @@ trait CustomActionTrait
case 'drawer': case 'drawer':
$drawer = Drawer::make()->title(__('admin.show'))->name('detail_info')->body($this->detail('$id'))->closeOnOutside(); $drawer = Drawer::make()->title(__('admin.show'))->name('detail_info')->body($this->detail('$id'))->closeOnOutside();
if($width){ if ($width) {
$drawer->width($width); $drawer->width($width);
}else{ } else {
$drawer->size($size); $drawer->size($size);
} }
//补充详情操作按钮扩展 //补充详情操作按钮扩展
try{ try {
$actions = $this->detailActions(); $actions = $this->detailActions();
}catch(\BadMethodCallException $e){ } catch (\BadMethodCallException $e) {
$actions = []; $actions = [];
} }
$drawer->actions($actions); $drawer->actions($actions);
@ -130,9 +111,9 @@ trait CustomActionTrait
case 'dialog': case 'dialog':
//补充详情操作按钮扩展 //补充详情操作按钮扩展
$dialog = Dialog::make()->title(__('admin.show'))->name('detail_info')->body($this->detail('$id'))->size($size); $dialog = Dialog::make()->title(__('admin.show'))->name('detail_info')->body($this->detail('$id'))->size($size);
try{ try {
$actions = $this->detailActions(); $actions = $this->detailActions();
}catch(\BadMethodCallException $e){ } catch (\BadMethodCallException $e) {
$actions = []; $actions = [];
} }
$dialog->actions($actions); $dialog->actions($actions);
@ -145,4 +126,4 @@ trait CustomActionTrait
return $button->label(__('admin.show'))->icon('fa-regular fa-eye')->level('link'); return $button->label(__('admin.show'))->icon('fa-regular fa-eye')->level('link');
} }
} }

View File

@ -2,10 +2,10 @@
namespace App\Traits; namespace App\Traits;
use Slowlyo\OwlAdmin\Admin;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Slowlyo\OwlAdmin\Admin;
trait UploadTrait trait UploadTrait
{ {
@ -25,17 +25,17 @@ trait UploadTrait
public function uploadRich() public function uploadRich()
{ {
$fromWangEditor = false; $fromWangEditor = false;
$file = request()->file('file'); $file = request()->file('file');
if (!$file) { if (! $file) {
$fromWangEditor = true; $fromWangEditor = true;
$file = request()->file('wangeditor-uploaded-image'); $file = request()->file('wangeditor-uploaded-image');
if (!$file) { if (! $file) {
$file = request()->file('wangeditor-uploaded-video'); $file = request()->file('wangeditor-uploaded-video');
} }
} }
if (!$file) { if (! $file) {
return $this->response()->additional(['errno' => 1])->fail(__('admin.upload_file_error')); return $this->response()->additional(['errno' => 1])->fail(__('admin.upload_file_error'));
} }
@ -57,71 +57,72 @@ trait UploadTrait
{ {
$file = request()->file('file'); $file = request()->file('file');
if (!$file) { if (! $file) {
return $this->response()->fail(__('admin.upload_file_error')); 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]); 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); $file = request()->file($field);
if (!$file) { if (! $file) {
$file = request()->get($field); $file = request()->get($field);
} }
$fileArr = []; $fileArr = [];
//判断是否多个文件; //判断是否多个文件;
if(is_string($file) || isset($file['id'])){ if (is_string($file) || isset($file['id'])) {
$files = [$file]; $files = [$file];
}else{ } else {
$files = $file; $files = $file;
} }
if($files){ if ($files) {
foreach($files as $file){ foreach ($files as $file) {
if(is_array($file) && isset($file['state'])){ if (is_array($file) && isset($file['state'])) {
switch($file['state']){ switch ($file['state']) {
case 'init': case 'init':
if(strpos($file['value'], 'temporary') !== false){ if (strpos($file['value'], 'temporary') !== false) {
$filePath = $path.'/'.$file['name']; $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); $fileArr[] = Storage::disk(Admin::config('admin.upload.disk'))->url($filePath);
}else{ } else {
$fileArr[] = $file['value']; $fileArr[] = $file['value'];
} }
break; break;
case 'uploaded': case 'uploaded':
if(isset($file['name'])){ if (isset($file['name'])) {
$filePath = $path.'/'.$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']); $fileUrl = parse_url($file['value']);
$fileValue = ltrim($fileUrl['path'], '/'); $fileValue = ltrim($fileUrl['path'], '/');
}else{ } else {
$fileValue = $file['value']; $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); $fileArr[] = Storage::disk(Admin::config('admin.upload.disk'))->url($filePath);
} }
break; break;
} }
}else{ } else {
$fileArr[] = $file; $fileArr[] = $file;
} }
} }
} }
return $fileArr; return $fileArr;
} }
@ -135,8 +136,8 @@ trait UploadTrait
$uploadId = md5(time().$fileName); $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'))->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'))->makeDirectory(Admin::config('admin.upload.tem_directory.'.$type).'/'.$uploadId) === false) {
return false; return false;
} }
} }
@ -159,14 +160,15 @@ trait UploadTrait
$fileName = $file->getClientOriginalName(); $fileName = $file->getClientOriginalName();
//判断该分片是否已存在, //判断该分片是否已存在,
$dirPath = Admin::config('admin.upload.tem_directory.' . $type).'/'.$uploadId; $dirPath = Admin::config('admin.upload.tem_directory.'.$type).'/'.$uploadId;
if(Storage::disk(Admin::config('admin.upload.disk'))->exists($dirPath . '/'.$fileName.'_'.$partNumber)){ if (Storage::disk(Admin::config('admin.upload.disk'))->exists($dirPath.'/'.$fileName.'_'.$partNumber)) {
return $this->response()->fail(__('admin.upload_file_error')); return $this->response()->fail(__('admin.upload_file_error'));
}else{ } else {
//验证分片大小-todo //验证分片大小-todo
$path = $file->storeAs($dirPath, $fileName.'_'.$partNumber, Admin::config('admin.upload.disk')); $path = $file->storeAs($dirPath, $fileName.'_'.$partNumber, Admin::config('admin.upload.disk'));
$realPath = Storage::disk(Admin::config('admin.upload.disk'))->url($path); $realPath = Storage::disk(Admin::config('admin.upload.disk'))->url($path);
$eTag = md5_file($realPath); $eTag = md5_file($realPath);
return $this->response()->success(['eTag' => $eTag]); return $this->response()->success(['eTag' => $eTag]);
} }
} }
@ -182,18 +184,18 @@ trait UploadTrait
$uploadId = request()->get('uploadId', ''); $uploadId = request()->get('uploadId', '');
$partList = request()->get('partList', []); $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; $realPath = 'chunk/'.$fileName;
//获取分片列表中序号,查看分片是否都完成上传 //获取分片列表中序号,查看分片是否都完成上传
$partNumberList = Arr::pluck($partList, 'partNumber'); $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; $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); $_file = Storage::disk(Admin::config('admin.upload.disk'))->get($basePath.'/'.$fileName.'_'.$i);
Storage::disk(Admin::config('admin.upload.disk'))->append($realPath, $_file, null); 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); $value = Storage::disk(Admin::config('admin.upload.disk'))->url($realPath);
return $this->response()->success(['value'=>$value]); return $this->response()->success(['value' => $value]);
}else{ } else {
return $this->response()->fail(__('admin.upload_file_error')); return $this->response()->fail(__('admin.upload_file_error'));
} }
} }
} }

View File

@ -2,26 +2,26 @@
return [ return [
// 应用名称 // 应用名称
'name' => 'Owl Admin', 'name' => 'Owl Admin',
// 应用 logo // 应用 logo
'logo' => '/admin-assets/logo.png', 'logo' => '/admin-assets/logo.png',
// 默认头像 // 默认头像
'default_avatar' => '/admin-assets/default-avatar.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' => [ 'route' => [
'prefix' => 'admin-api', 'prefix' => 'admin-api',
'domain' => null, 'domain' => null,
'namespace' => 'App\\Admin\\Controllers', 'namespace' => 'App\\Admin\\Controllers',
'middleware' => ['admin'], 'middleware' => ['admin'],
// 不包含额外路由, 配置后, 不会追加新增/详情/编辑页面路由 // 不包含额外路由, 配置后, 不会追加新增/详情/编辑页面路由
'without_extra_routes' => [ 'without_extra_routes' => [
'/dashboard', '/dashboard',
@ -32,60 +32,60 @@ return [
// 是否开启验证码 // 是否开启验证码
'login_captcha' => env('ADMIN_LOGIN_CAPTCHA', true), 'login_captcha' => env('ADMIN_LOGIN_CAPTCHA', true),
// 是否开启认证 // 是否开启认证
'enable' => true, 'enable' => true,
// 是否开启鉴权 // 是否开启鉴权
'permission' => true, 'permission' => true,
'guard' => 'admin', 'guard' => 'admin',
'guards' => [ 'guards' => [
'admin' => [ 'admin' => [
'driver' => 'sanctum', 'driver' => 'sanctum',
'provider' => 'admin', 'provider' => 'admin',
], ],
], ],
'providers' => [ 'providers' => [
'admin' => [ 'admin' => [
'driver' => 'eloquent', 'driver' => 'eloquent',
'model' => \App\Models\AdminUser::class, 'model' => \App\Models\AdminUser::class,
], ],
], ],
'except' => [ 'except' => [
], ],
], ],
'upload' => [ 'upload' => [
'disk' => env("FILESYSTEM_DISK", 'public'), 'disk' => env('FILESYSTEM_DISK', 'public'),
// 文件上传目录 // 文件上传目录
'directory' => [ 'directory' => [
'image' => 'images', 'image' => 'images',
'file' => 'files', 'file' => 'files',
'rich' => 'rich', '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), 'show_auto_generate_permission_button' => env('ADMIN_SHOW_AUTO_GENERATE_PERMISSION_BUTTON', true),
// 扩展 // 扩展
'extension' => [ 'extension' => [
'dir' => base_path('extensions'), 'dir' => base_path('extensions'),
], ],
'layout' => [ 'layout' => [
// 浏览器标题, 功能名称使用 %title% 代替 // 浏览器标题, 功能名称使用 %title% 代替
'title' => '%title% | OwlAdmin', 'title' => '%title% | OwlAdmin',
'header' => [ 'header' => [
// 是否显示 [刷新] 按钮 // 是否显示 [刷新] 按钮
'refresh' => true, 'refresh' => true,
// 是否显示 [暗色模式] 按钮 // 是否显示 [暗色模式] 按钮
'dark' => true, 'dark' => true,
// 是否显示 [全屏] 按钮 // 是否显示 [全屏] 按钮
'full_screen' => true, 'full_screen' => true,
// 是否显示 [主题配置] 按钮 // 是否显示 [主题配置] 按钮
'theme_config' => true, 'theme_config' => true,
], ],
@ -100,7 +100,7 @@ return [
*/ */
'keep_alive_exclude' => [], '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' => [ 'database' => [
@ -108,9 +108,9 @@ return [
], ],
'models' => [ 'models' => [
'admin_user' => \App\Models\AdminUser::class, 'admin_user' => \App\Models\AdminUser::class,
'admin_role' => \App\Models\AdminRole::class, 'admin_role' => \App\Models\AdminRole::class,
'admin_menu' => \Slowlyo\OwlAdmin\Models\AdminMenu::class, 'admin_menu' => \Slowlyo\OwlAdmin\Models\AdminMenu::class,
'admin_permission' => \Slowlyo\OwlAdmin\Models\AdminPermission::class, 'admin_permission' => \Slowlyo\OwlAdmin\Models\AdminPermission::class,
], ],

View File

@ -56,21 +56,21 @@ return [
'throw' => false, 'throw' => false,
], ],
"oss" => [ 'oss' => [
"driver" => "oss", 'driver' => 'oss',
"access_key_id" => env("OSS_ACCESS_KEY_ID"), // 必填, 阿里云的AccessKeyId 'access_key_id' => env('OSS_ACCESS_KEY_ID'), // 必填, 阿里云的AccessKeyId
"access_key_secret" => env("OSS_ACCESS_KEY_SECRET"), // 必填, 阿里云的AccessKeySecret 'access_key_secret' => env('OSS_ACCESS_KEY_SECRET'), // 必填, 阿里云的AccessKeySecret
"bucket" => env("OSS_BUCKET"), // 必填, 对象存储的Bucket, 示例: my-bucket 'bucket' => env('OSS_BUCKET'), // 必填, 对象存储的Bucket, 示例: my-bucket
"endpoint" => env("OSS_ENDPOINT"), // 必填, 对象存储的Endpoint, 示例: oss-cn-shanghai.aliyuncs.com 'endpoint' => env('OSS_ENDPOINT'), // 必填, 对象存储的Endpoint, 示例: oss-cn-shanghai.aliyuncs.com
"internal" => env("OSS_INTERNAL", null), // 选填, 内网上传地址,填写即启用 示例: oss-cn-shanghai-internal.aliyuncs.com 'internal' => env('OSS_INTERNAL', null), // 选填, 内网上传地址,填写即启用 示例: oss-cn-shanghai-internal.aliyuncs.com
"domain" => env("OSS_DOMAIN", null), // 选填, 绑定域名,填写即启用 示例: oss.my-domain.com 'domain' => env('OSS_DOMAIN', null), // 选填, 绑定域名,填写即启用 示例: oss.my-domain.com
"is_cname" => env("OSS_CNAME", false), // 选填, 若Endpoint为自定义域名此项要为truehttps://github.com/aliyun/aliyun-oss-php-sdk/blob/572d0f8e099e8630ae7139ed3fdedb926c7a760f/src/OSS/OssClient.php#L113C1-L122C78 'is_cname' => env('OSS_CNAME', false), // 选填, 若Endpoint为自定义域名此项要为truehttps://github.com/aliyun/aliyun-oss-php-sdk/blob/572d0f8e099e8630ae7139ed3fdedb926c7a760f/src/OSS/OssClient.php#L113C1-L122C78
"prefix" => env("OSS_PREFIX", ""), // 选填, 统一存储地址前缀 'prefix' => env('OSS_PREFIX', ''), // 选填, 统一存储地址前缀
"use_ssl" => env("OSS_SSL", false), // 选填, 是否使用HTTPS 'use_ssl' => env('OSS_SSL', false), // 选填, 是否使用HTTPS
"reverse_proxy" => env("OSS_REVERSE_PROXY", false), // 选填, 域名是否使用NGINX代理绑定 'reverse_proxy' => env('OSS_REVERSE_PROXY', false), // 选填, 域名是否使用NGINX代理绑定
"throw" => env("OSS_THROW", true), // 选填, 是否抛出引起错误的异常,默认出现错误时,不抛出异常仅返回false 'throw' => env('OSS_THROW', true), // 选填, 是否抛出引起错误的异常,默认出现错误时,不抛出异常仅返回false
"options" => [], // 选填, 添加全局配置参数, 示例: [\OSS\OssClient::OSS_CHECK_MD5 => false] 'options' => [], // 选填, 添加全局配置参数, 示例: [\OSS\OssClient::OSS_CHECK_MD5 => false]
"macros" => [] // 选填, 添加自定义Macro, 示例: [\App\Macros\ListBuckets::class, \App\Macros\CreateBucket::class] 'macros' => [], // 选填, 添加自定义Macro, 示例: [\App\Macros\ListBuckets::class, \App\Macros\CreateBucket::class]
], ],
], ],

View File

@ -2,10 +2,9 @@
namespace Database\Seeders; namespace Database\Seeders;
use Slowlyo\OwlAdmin\Models\AdminMenu;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str; use Slowlyo\OwlAdmin\Models\AdminMenu;
use Throwable; use Throwable;
class AdminMenuSeeder extends Seeder class AdminMenuSeeder extends Seeder
@ -19,23 +18,23 @@ class AdminMenuSeeder extends Seeder
{ {
// //
$menus = [ $menus = [
['title' => 'index', 'icon' => 'line-md:home-twotone-alt', 'url' => '/index', 'is_home'=>1, 'order'=>1], ['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' => 'admin_system', 'icon' => 'material-symbols:settings-outline', 'url' => '/system', 'order' => 2,
'children' => [ 'children' => [
['title' => 'admin_users', 'icon' => 'ph:user-gear', 'url' => '/system/admin_users', 'order'=>1], ['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_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_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_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' => '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' => '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(); DB::table('admin_menus')->truncate();
try { try {

View File

@ -121,7 +121,7 @@ class AdminPermissionSeeder extends Seeder
{ {
foreach ($data as $slug => $node) { foreach ($data as $slug => $node) {
$permission = AdminPermission::updateOrCreate([ $permission = AdminPermission::updateOrCreate([
'slug' => ($parent->slug ?? 'admin') . '.' . $slug, 'slug' => ($parent->slug ?? 'admin').'.'.$slug,
], [ ], [
'parent_id' => $parent->id ?? 0, 'parent_id' => $parent->id ?? 0,
'name' => is_array($node) ? $node['name'] : $node, 'name' => is_array($node) ? $node['name'] : $node,
@ -143,7 +143,7 @@ class AdminPermissionSeeder extends Seeder
foreach ($resourceAbilities as $resourceAbility) { foreach ($resourceAbilities as $resourceAbility) {
AdminPermission::updateOrCreate([ AdminPermission::updateOrCreate([
'slug' => $permission->slug . '.' . $resourceAbility, 'slug' => $permission->slug.'.'.$resourceAbility,
], [ ], [
'parent_id' => $permission->id, 'parent_id' => $permission->id,
'name' => $this->resourceAbilityMap()[$resourceAbility], 'name' => $this->resourceAbilityMap()[$resourceAbility],

View File

@ -34,7 +34,7 @@ class KeywordSeeder extends Seeder
[ [
'key' => 'job', 'key' => 'job',
'name' => '职位', 'name' => '职位',
'children' => ['普通员工', '小组长', '主管'] 'children' => ['普通员工', '小组长', '主管'],
], ],
[ [
'key' => 'store_category', 'key' => 'store_category',
@ -54,7 +54,7 @@ class KeywordSeeder extends Seeder
['name' => '电脑整机'], ['name' => '电脑整机'],
['name' => '外设产品'], ['name' => '外设产品'],
['name' => '网络产品'], ['name' => '网络产品'],
]] ]],
], ],
], ],
[ [
@ -86,7 +86,7 @@ class KeywordSeeder extends Seeder
$item['sort'] = $i + 1; $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 */ /** @var \App\Models\Keyword */
$keyword = Keyword::updateOrCreate( $keyword = Keyword::updateOrCreate(

View File

@ -1,219 +1,219 @@
<?php <?php
return [ return [
'remember_me' => 'Remember me', 'remember_me' => 'Remember me',
'login' => 'Login', 'login' => 'Login',
'logout' => 'Logout', 'logout' => 'Logout',
'username' => 'Username', 'username' => 'Username',
'password' => 'Password', 'password' => 'Password',
'old_password' => 'Old Password', 'old_password' => 'Old Password',
'confirm_password' => 'Confirm Password', 'confirm_password' => 'Confirm Password',
'captcha' => 'Captcha', 'captcha' => 'Captcha',
'captcha_error' => 'Captcha Error', 'captcha_error' => 'Captcha Error',
'required' => ':attribute is required', 'required' => ':attribute is required',
'login_successful' => 'Login Success', 'login_successful' => 'Login Success',
'login_failed' => 'Username Or Password Error', 'login_failed' => 'Username Or Password Error',
'user_setting' => 'User Settings', 'user_setting' => 'User Settings',
'created_at' => 'Created At', 'created_at' => 'Created At',
'updated_at' => 'Updated At', 'updated_at' => 'Updated At',
'deleted_at' => 'Deleted At', 'deleted_at' => 'Deleted At',
'actions' => 'Actions', 'actions' => 'Actions',
'create' => 'Create', 'create' => 'Create',
'edit' => 'Edit', 'edit' => 'Edit',
'show' => 'Show', 'show' => 'Show',
'delete' => 'Delete', 'delete' => 'Delete',
'copy' => 'Copy', 'copy' => 'Copy',
'confirm_delete' => 'Confirm Delete Selected Items?', 'confirm_delete' => 'Confirm Delete Selected Items?',
'back' => 'Back', 'back' => 'Back',
'reset' => 'Reset', 'reset' => 'Reset',
'search' => 'Search', 'search' => 'Search',
'list' => 'List', 'list' => 'List',
'add' => 'Add', 'add' => 'Add',
'save' => 'Save', 'save' => 'Save',
'detail' => 'Detail', 'detail' => 'Detail',
'developer' => 'Developer', 'developer' => 'Developer',
'code_generator' => 'Code Generator', 'code_generator' => 'Code Generator',
'visual_editor' => 'Visual Editor', 'visual_editor' => 'Visual Editor',
'terminal' => 'Terminal', 'terminal' => 'Terminal',
'administrator' => 'Administrator', 'administrator' => 'Administrator',
'soft_delete' => 'Soft Delete', 'soft_delete' => 'Soft Delete',
'keyword' => 'Keyword', 'keyword' => 'Keyword',
'unknown_error' => 'Unknown Error', 'unknown_error' => 'Unknown Error',
'upload_file_error' => 'Upload File Error', 'upload_file_error' => 'Upload File Error',
'parent' => 'Parent', 'parent' => 'Parent',
'order' => 'Order', 'order' => 'Order',
'order_desc' => 'Order Desc', 'order_desc' => 'Order Desc',
'order_asc' => 'Order Asc', 'order_asc' => 'Order Asc',
'menus' => 'Menus', 'menus' => 'Menus',
'successfully' => 'Successfully', 'successfully' => 'Successfully',
'failed' => 'Failed', 'failed' => 'Failed',
'successfully_message' => ':attribute Successfully', 'successfully_message' => ':attribute Successfully',
'failed_message' => ':attribute Failed', 'failed_message' => ':attribute Failed',
'action_success' => 'Action Success', 'action_success' => 'Action Success',
'action_failed' => 'Action Failed', 'action_failed' => 'Action Failed',
'save_success' => 'Save Success', 'save_success' => 'Save Success',
'save_failed' => 'Save Failed', 'save_failed' => 'Save Failed',
'yes' => 'Yes', 'yes' => 'Yes',
'no' => 'No', 'no' => 'No',
'need_start_with_slash' => 'Need Start With /', 'need_start_with_slash' => 'Need Start With /',
'cancel' => 'Cancel', 'cancel' => 'Cancel',
'please_login' => 'Please Login', 'please_login' => 'Please Login',
'unauthorized' => 'Unauthorized', 'unauthorized' => 'Unauthorized',
'code_generators' => [ 'code_generators' => [
'remark1' => 'For more parameters, please refer to', 'remark1' => 'For more parameters, please refer to',
'remark2' => 'Database Migration', 'remark2' => 'Database Migration',
'remark3' => 'Multiple parameters are separated by English commas', 'remark3' => 'Multiple parameters are separated by English commas',
'table_name' => 'Table Name', 'table_name' => 'Table Name',
'model_name' => 'Model', 'model_name' => 'Model',
'controller_name' => 'Controller', 'controller_name' => 'Controller',
'service_name' => 'Service', 'service_name' => 'Service',
'primary_key' => 'Primary Key', 'primary_key' => 'Primary Key',
'primary_key_description' => 'Use increments method', 'primary_key_description' => 'Use increments method',
'options' => 'Options', 'options' => 'Options',
'create_database_migration' => 'Create Database Migration File', 'create_database_migration' => 'Create Database Migration File',
'create_table' => 'Create Table', 'create_table' => 'Create Table',
'create_model' => 'Create Model', 'create_model' => 'Create Model',
'create_controller' => 'Create Controller', 'create_controller' => 'Create Controller',
'create_service' => 'Create Service', 'create_service' => 'Create Service',
'app_title' => 'App Title', 'app_title' => 'App Title',
'column_name' => 'Column Name', 'column_name' => 'Column Name',
'type' => 'Type', 'type' => 'Type',
'extra_params' => 'Extra Params', 'extra_params' => 'Extra Params',
'nullable' => 'Nullable', 'nullable' => 'Nullable',
'index' => 'Index', 'index' => 'Index',
'default_value' => 'Default Value', 'default_value' => 'Default Value',
'comment' => 'Comment', 'comment' => 'Comment',
'exists_table' => 'Exists Table', 'exists_table' => 'Exists Table',
'generate_code' => 'Generate Code', 'generate_code' => 'Generate Code',
'expand_more_settings' => 'More Settings', 'expand_more_settings' => 'More Settings',
'collapse_settings' => 'Collapse Settings', 'collapse_settings' => 'Collapse Settings',
'confirm_generate_code' => 'Confirm Generate Code?', 'confirm_generate_code' => 'Confirm Generate Code?',
'preview' => 'Preview', 'preview' => 'Preview',
'base_info' => 'Base Info', 'base_info' => 'Base Info',
'column_info' => 'Column Info', 'column_info' => 'Column Info',
'route_config' => 'Route Config', 'route_config' => 'Route Config',
'page_config' => 'Page Config', 'page_config' => 'Page Config',
'gen_route_menu' => 'Generate Route And Menu', 'gen_route_menu' => 'Generate Route And Menu',
'route' => 'Route', 'route' => 'Route',
'menu_name' => 'Menu Name', 'menu_name' => 'Menu Name',
'parent_menu' => 'Parent Menu', 'parent_menu' => 'Parent Menu',
'menu_icon' => 'Menu Icon', 'menu_icon' => 'Menu Icon',
'name_label_desc' => 'Name And Label Attribute Take Field Name And Comment', '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!', 'column_warning' => 'If the field name exists (no / status) will cause the form to fail to echo back!',
'add_column' => 'Add Column', 'add_column' => 'Add Column',
'scope' => 'Scope', 'scope' => 'Scope',
'list_component' => 'List Component', 'list_component' => 'List Component',
'list_component_desc' => 'List Component, Default Is TableColumn', 'list_component_desc' => 'List Component, Default Is TableColumn',
'form_component' => 'Form Component', 'form_component' => 'Form Component',
'form_component_desc' => 'Form Component, Default Is TextControl', 'form_component_desc' => 'Form Component, Default Is TextControl',
'detail_component' => 'Detail Component', 'detail_component' => 'Detail Component',
'detail_component_desc' => 'Detail Component, Default Is TextControl', 'detail_component_desc' => 'Detail Component, Default Is TextControl',
'model_config' => 'Model Config', 'model_config' => 'Model Config',
'file_column' => 'File Column', 'file_column' => 'File Column',
'file_column_desc' => 'File Column, Automatically Add Attribute Methods In The Model', 'file_column_desc' => 'File Column, Automatically Add Attribute Methods In The Model',
'preview_code' => 'Preview Code', 'preview_code' => 'Preview Code',
'property' => 'Property', 'property' => 'Property',
'property_name' => 'Property Name', 'property_name' => 'Property Name',
'value' => 'Value', 'value' => 'Value',
'dialog_form' => 'Dialog Form', 'dialog_form' => 'Dialog Form',
'dialog_size' => 'Dialog Size', 'dialog_size' => 'Dialog Size',
'copy_record' => 'Copy Record', '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>', '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' => 'Import Record',
'import_record_placeholder' => 'Please enter the imported json 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>', '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_config' => 'Load Config',
'load_component_config' => 'Load :c Config', 'load_component_config' => 'Load :c Config',
'fill' => 'Fill', 'fill' => 'Fill',
'save_current_config' => 'Save Current Config', 'save_current_config' => 'Save Current Config',
'input_config_name' => 'Please Input Config Name', 'input_config_name' => 'Please Input Config Name',
'same_name_tips' => 'Configurations with the same name will be overwritten', 'same_name_tips' => 'Configurations with the same name will be overwritten',
], ],
'admin_users' => 'Admin Users', 'admin_users' => 'Admin Users',
'admin_user' => [ 'admin_user' => [
'avatar' => 'Avatar', 'avatar' => 'Avatar',
'name' => 'Name', 'name' => 'Name',
'roles' => 'Roles', 'roles' => 'Roles',
'search_username' => 'Search Username/Name', 'search_username' => 'Search Username/Name',
'password_confirmation' => 'Password Not Match', 'password_confirmation' => 'Password Not Match',
'old_password_required' => 'Old Password Required', 'old_password_required' => 'Old Password Required',
'old_password_error' => 'Old Password Error', 'old_password_error' => 'Old Password Error',
'username_already_exists' => 'Username Already Exists', 'username_already_exists' => 'Username Already Exists',
], ],
'admin_roles' => 'Admin Roles', 'admin_roles' => 'Admin Roles',
'admin_role' => [ 'admin_role' => [
'name' => 'Name', 'name' => 'Name',
'slug' => 'Slug', 'slug' => 'Slug',
'permissions' => 'Permissions', 'permissions' => 'Permissions',
'slug_description' => 'unique identifier of a role', 'slug_description' => 'unique identifier of a role',
'name_already_exists' => 'Role Name Already Exists', 'name_already_exists' => 'Role Name Already Exists',
'slug_already_exists' => 'Role Slug Already Exists', 'slug_already_exists' => 'Role Slug Already Exists',
'set_permissions' => 'Set Permissions', 'set_permissions' => 'Set Permissions',
], ],
'admin_permissions' => 'Permissions', 'admin_permissions' => 'Permissions',
'admin_permission' => [ 'admin_permission' => [
'name' => 'Name', 'name' => 'Name',
'slug' => 'Slug', 'slug' => 'Slug',
'http_method' => 'Http Method', 'http_method' => 'Http Method',
'http_method_description' => 'if you do not select the value is ANY', 'http_method_description' => 'if you do not select the value is ANY',
'http_path' => 'Http Path', 'http_path' => 'Http Path',
'auto_generate' => 'Auto Generate', '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?', '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', 'parent_id_not_allow' => 'Parent Id Not Allow',
'name_already_exists' => 'Permission Name Already Exists', 'name_already_exists' => 'Permission Name Already Exists',
'slug_already_exists' => 'Permission Slug Already Exists', 'slug_already_exists' => 'Permission Slug Already Exists',
], ],
'admin_menus' => 'Menus', 'admin_menus' => 'Menus',
'admin_menu' => [ 'admin_menu' => [
'parent_id' => 'Parent', 'parent_id' => 'Parent',
'order' => 'Order', 'order' => 'Order',
'title' => 'Title', 'title' => 'Title',
'icon' => 'Icon', 'icon' => 'Icon',
'icon_description' => 'Please refer to ', 'icon_description' => 'Please refer to ',
'url' => 'Url', 'url' => 'Url',
'visible' => 'Visible', 'visible' => 'Visible',
'type' => 'Type', 'type' => 'Type',
'api' => 'Page API', 'api' => 'Page API',
'api_description' => 'schemaApi, the api for page initialization requests, needs to be consistent with queryPath in Controller', 'api_description' => 'schemaApi, the api for page initialization requests, needs to be consistent with queryPath in Controller',
'route' => 'Route', 'route' => 'Route',
'link' => 'Link', 'link' => 'Link',
'class_name' => 'Class Name', 'class_name' => 'Class Name',
'class_name_description' => 'The CSS class name of the menu, which is typically used to customize styles', 'class_name_description' => 'The CSS class name of the menu, which is typically used to customize styles',
'show' => 'Show', 'show' => 'Show',
'hide' => 'Hide', 'hide' => 'Hide',
'is_home' => 'Is Home', 'is_home' => 'Is Home',
'is_home_description' => 'In multi-tab mode, the page label is fixed on the left', 'is_home_description' => 'In multi-tab mode, the page label is fixed on the left',
'is_full' => 'Is Full', 'is_full' => 'Is Full',
'is_full_description' => 'When enabled, the menu bar portion of the page is hidden', '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', 'parent_id_not_allow' => 'The parent menu cannot be set to the current submenu',
'component' => 'Component', 'component' => 'Component',
'component_desc' => 'amis by default. Not a custom front-end page, please do not modify it', 'component_desc' => 'amis by default. Not a custom front-end page, please do not modify it',
], ],
'extensions' => [ 'extensions' => [
'name_invalid' => 'Name Invalid', 'name_invalid' => 'Name Invalid',
'exists' => 'This extension already exists: ', 'exists' => 'This extension already exists: ',
'menu' => 'Extensions', 'menu' => 'Extensions',
'page_title' => 'Extensions', 'page_title' => 'Extensions',
'create' => 'Create', 'create' => 'Create',
'install' => 'Install', 'install' => 'Install',
'create_extension' => 'Create Extension', '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', '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', 'local_install' => 'Local Install',
'more_extensions' => 'More Extensions', 'more_extensions' => 'More Extensions',
'setting' => 'Setting', 'setting' => 'Setting',
'enable' => 'Enable', 'enable' => 'Enable',
'enable_confirm' => 'Are you sure to enable the extension?', 'enable_confirm' => 'Are you sure to enable the extension?',
'disable' => 'Disable', 'disable' => 'Disable',
'disable_confirm' => 'Are you sure to disable the extension?', 'disable_confirm' => 'Are you sure to disable the extension?',
'uninstall' => 'Uninstall', 'uninstall' => 'Uninstall',
'uninstall_confirm' => ' 'uninstall_confirm' => '
<div class="text-danger"> <div class="text-danger">
Confirm to uninstall the extension?<br> Confirm to uninstall the extension?<br>
Uninstallation will delete all files and databases published after the extension is enabled and cannot be retrieved!!!<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> </div>
', ',
'filter_placeholder' => 'Search by extension name', 'filter_placeholder' => 'Search by extension name',
'form' => [ 'form' => [
'create_extension' => 'Create Extension', 'create_extension' => 'Create Extension',
'name' => 'Name', 'name' => 'Name',
'namespace' => 'Namespace', 'namespace' => 'Namespace',
'create_description' => 'It will be created in :dir Directory to create a basic extended directory structure', 'create_description' => 'It will be created in :dir Directory to create a basic extended directory structure',
], ],
'card' => [ 'card' => [
'author' => 'Author', 'author' => 'Author',
'version' => 'Version', 'version' => 'Version',
'homepage' => 'Home', 'homepage' => 'Home',
'status' => 'Status', 'status' => 'Status',
], ],
'status_map' => [ 'status_map' => [
'enabled' => 'Enabled', 'enabled' => 'Enabled',
'disabled' => 'Disabled', 'disabled' => 'Disabled',
], ],
'validation' => [ 'validation' => [
'file' => 'Please select file', 'file' => 'Please select file',
'invalid_package' => 'Invalid extension package', 'invalid_package' => 'Invalid extension package',
], ],
], ],
'export' => [ 'export' => [
'title' => 'Export', 'title' => 'Export',
'all' => 'All', 'all' => 'All',
'page' => 'Current Page', 'page' => 'Current Page',
'selected_rows' => 'Selected Rows', 'selected_rows' => 'Selected Rows',
'page_no_data' => 'Current page has no data', 'page_no_data' => 'Current page has no data',
'selected_rows_no_data' => 'No data is selected', 'selected_rows_no_data' => 'No data is selected',
'please_install_laravel_excel' => 'Please install the package "maatwebsite/excel" first', 'please_install_laravel_excel' => 'Please install the package "maatwebsite/excel" first',
], ],
]; ];

View File

@ -1,11 +1,11 @@
<?php <?php
return [ return [
'dashboard' => 'Dashboard', 'dashboard' => 'Dashboard',
'admin_system' => 'Admin', 'admin_system' => 'Admin',
'admin_users' => 'Users', 'admin_users' => 'Users',
'admin_roles' => 'Roles', 'admin_roles' => 'Roles',
'admin_permission' => 'Permissions', 'admin_permission' => 'Permissions',
'admin_menu' => 'Menus', 'admin_menu' => 'Menus',
'admin_setting' => 'Settings', 'admin_setting' => 'Settings',
]; ];

View File

@ -1,219 +1,219 @@
<?php <?php
return [ return [
'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', 'required' => '请填写:attribute',
'login_successful' => '登录成功', 'login_successful' => '登录成功',
'login_failed' => '用户名或密码错误', 'login_failed' => '用户名或密码错误',
'user_setting' => '个人设置', 'user_setting' => '个人设置',
'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' => '确认删除选中项?',
'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_message' => ':attribute成功',
'failed_message' => ':attribute失败', 'failed_message' => ':attribute失败',
'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_slash' => '需要以 / 开头',
'cancel' => '取消', 'cancel' => '取消',
'please_login' => '请先登录', 'please_login' => '请先登录',
'unauthorized' => '无权访问', 'unauthorized' => '无权访问',
'code_generators' => [ 'code_generators' => [
'remark1' => '额外参数请参考', 'remark1' => '额外参数请参考',
'remark2' => '数据库迁移', 'remark2' => '数据库迁移',
'remark3' => '多个参数使用英文逗号分割', 'remark3' => '多个参数使用英文逗号分割',
'table_name' => '表名', 'table_name' => '表名',
'model_name' => '模型', 'model_name' => '模型',
'controller_name' => '控制器', 'controller_name' => '控制器',
'service_name' => 'Service', 'service_name' => 'Service',
'primary_key' => '主键名称', 'primary_key' => '主键名称',
'primary_key_description' => '使用 increments 方法', 'primary_key_description' => '使用 increments 方法',
'options' => '可选项', 'options' => '可选项',
'create_database_migration' => '创建数据库迁移文件', 'create_database_migration' => '创建数据库迁移文件',
'create_table' => '创建数据表', 'create_table' => '创建数据表',
'create_model' => '创建模型', 'create_model' => '创建模型',
'create_controller' => '创建控制器', 'create_controller' => '创建控制器',
'create_service' => '创建Service', 'create_service' => '创建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' => '更多设置', 'expand_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' => '生成路由&菜单', 'gen_route_menu' => '生成路由&菜单',
'route' => '路由', 'route' => '路由',
'menu_name' => '菜单名称', 'menu_name' => '菜单名称',
'parent_menu' => '父级菜单', 'parent_menu' => '父级菜单',
'menu_icon' => '菜单图标', 'menu_icon' => '菜单图标',
'name_label_desc' => 'name和label属性取字段名和注释', 'name_label_desc' => 'name和label属性取字段名和注释',
'column_warning' => '如果字段名存在 no、status 会导致 form 回显失败!', 'column_warning' => '如果字段名存在 no、status 会导致 form 回显失败!',
'add_column' => '添加字段', 'add_column' => '添加字段',
'scope' => '作用域', 'scope' => '作用域',
'list_component' => '列表组件', 'list_component' => '列表组件',
'list_component_desc' => '列表组件, 默认为 TableColumn', 'list_component_desc' => '列表组件, 默认为 TableColumn',
'form_component' => '表单组件', 'form_component' => '表单组件',
'form_component_desc' => '表单组件, 默认为 TextControl', 'form_component_desc' => '表单组件, 默认为 TextControl',
'detail_component' => '详情组件', 'detail_component' => '详情组件',
'detail_component_desc' => '详情组件, 默认为 TextControl', 'detail_component_desc' => '详情组件, 默认为 TextControl',
'model_config' => '模型配置', 'model_config' => '模型配置',
'file_column' => '文件字段', 'file_column' => '文件字段',
'file_column_desc' => '文件字段会自动在模型中添加 获取/修改器 方法', 'file_column_desc' => '文件字段会自动在模型中添加 获取/修改器 方法',
'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' => '你可以复制后分享到 <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>', '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' => '导入记录',
'import_record_placeholder' => '请输入导入的json记录', '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> 找到一些其他人分享的记录', '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_config' => '加载配置',
'load_component_config' => '加载 :c 配置', 'load_component_config' => '加载 :c 配置',
'fill' => '填充', 'fill' => '填充',
'save_current_config' => '保存当前配置', 'save_current_config' => '保存当前配置',
'input_config_name' => '请填写配置名称', 'input_config_name' => '请填写配置名称',
'same_name_tips' => '相同名称的配置将会被覆盖' 'same_name_tips' => '相同名称的配置将会被覆盖',
], ],
'admin_users' => '管理员', 'admin_users' => '管理员',
'admin_user' => [ 'admin_user' => [
'avatar' => '头像', 'avatar' => '头像',
'name' => '姓名', 'name' => '姓名',
'roles' => '角色', 'roles' => '角色',
'search_username' => '搜索用户名/名称', 'search_username' => '搜索用户名/名称',
'password_confirmation' => '两次输入密码不一致', 'password_confirmation' => '两次输入密码不一致',
'old_password_required' => '请输入原密码', 'old_password_required' => '请输入原密码',
'old_password_error' => '原密码错误', 'old_password_error' => '原密码错误',
'username_already_exists' => '用户名已存在', 'username_already_exists' => '用户名已存在',
], ],
'admin_roles' => '角色', 'admin_roles' => '角色',
'admin_role' => [ 'admin_role' => [
'name' => '名称', 'name' => '名称',
'slug' => '标识', 'slug' => '标识',
'permissions' => '权限', 'permissions' => '权限',
'slug_description' => '角色的唯一标识, 不可重复', 'slug_description' => '角色的唯一标识, 不可重复',
'name_already_exists' => '角色名称已存在', 'name_already_exists' => '角色名称已存在',
'slug_already_exists' => '角色标识已存在', 'slug_already_exists' => '角色标识已存在',
'set_permissions' => '设置权限', 'set_permissions' => '设置权限',
], ],
'admin_permissions' => '权限', 'admin_permissions' => '权限',
'admin_permission' => [ 'admin_permission' => [
'name' => '名称', 'name' => '名称',
'slug' => '标识', 'slug' => '标识',
'http_method' => '请求方式', 'http_method' => '请求方式',
'http_method_description' => '不选则为ANY', 'http_method_description' => '不选则为ANY',
'http_path' => '路由', 'http_path' => '路由',
'auto_generate' => '自动生成', 'auto_generate' => '自动生成',
'auto_generate_confirm' => '权限信息会在 截断权限表&权限菜单关联表 后重新生成, 是否继续操作 ?', 'auto_generate_confirm' => '权限信息会在 截断权限表&权限菜单关联表 后重新生成, 是否继续操作 ?',
'parent_id_not_allow' => '父级不允许设置为当前子权限', 'parent_id_not_allow' => '父级不允许设置为当前子权限',
'name_already_exists' => '权限名称已存在', 'name_already_exists' => '权限名称已存在',
'slug_already_exists' => '权限标识已存在', 'slug_already_exists' => '权限标识已存在',
], ],
'admin_menus' => '菜单', 'admin_menus' => '菜单',
'admin_menu' => [ 'admin_menu' => [
'parent_id' => '父级', 'parent_id' => '父级',
'order' => '排序', 'order' => '排序',
'title' => '名称', 'title' => '名称',
'icon' => '图标', 'icon' => '图标',
'icon_description' => '请参考', 'icon_description' => '请参考',
'url' => '链接', 'url' => '链接',
'visible' => '可见', 'visible' => '可见',
'type' => '类型', 'type' => '类型',
'api' => '页面Api', 'api' => '页面Api',
'api_description' => 'schemaApi, 页面初始化请求的api, 需要与Controller中的queryPath一致', 'api_description' => 'schemaApi, 页面初始化请求的api, 需要与Controller中的queryPath一致',
'route' => '路由', 'route' => '路由',
'link' => '外链', 'link' => '外链',
'class_name' => '类名', 'class_name' => '类名',
'class_name_description' => '菜单的CSS类名, 一般用于自定义样式', 'class_name_description' => '菜单的CSS类名, 一般用于自定义样式',
'show' => '可见', 'show' => '可见',
'hide' => '隐藏', 'hide' => '隐藏',
'is_home' => '首页', 'is_home' => '首页',
'is_home_description' => '在多页签卡模式下,页面标签将固定在左侧', 'is_home_description' => '在多页签卡模式下,页面标签将固定在左侧',
'is_full' => '全屏', 'is_full' => '全屏',
'is_full_description' => '开启后将隐藏该页面的菜单栏部分', 'is_full_description' => '开启后将隐藏该页面的菜单栏部分',
'parent_id_not_allow' => '父级菜单不允许设置为当前子菜单', 'parent_id_not_allow' => '父级菜单不允许设置为当前子菜单',
'component' => '组件', 'component' => '组件',
'component_desc' => '默认为 amis , 非自定义前端页面请勿修改', 'component_desc' => '默认为 amis , 非自定义前端页面请勿修改',
], ],
'extensions' => [ 'extensions' => [
'name_invalid' => '无效的扩展名称', 'name_invalid' => '无效的扩展名称',
'exists' => '该扩展已存在:', 'exists' => '该扩展已存在:',
'menu' => '扩展', 'menu' => '扩展',
'page_title' => '扩展', 'page_title' => '扩展',
'create' => '创建', 'create' => '创建',
'install' => '安装', 'install' => '安装',
'create_extension' => '创建扩展', 'create_extension' => '创建扩展',
'create_tips' => '创建成功后会在<br><b>:dir</b><br>目录下创建基础的扩展目录结构', 'create_tips' => '创建成功后会在<br><b>:dir</b><br>目录下创建基础的扩展目录结构',
'local_install' => '本地安装', 'local_install' => '本地安装',
'more_extensions' => '更多扩展', 'more_extensions' => '更多扩展',
'setting' => '设置', 'setting' => '设置',
'enable' => '启用', 'enable' => '启用',
'enable_confirm' => '确定要启用该扩展吗?', 'enable_confirm' => '确定要启用该扩展吗?',
'disable' => '禁用', 'disable' => '禁用',
'disable_confirm' => '确定要禁用该扩展吗?', 'disable_confirm' => '确定要禁用该扩展吗?',
'uninstall' => '卸载', 'uninstall' => '卸载',
'uninstall_confirm' => ' 'uninstall_confirm' => '
<div class="text-danger"> <div class="text-danger">
确认卸载该扩展?<br> 确认卸载该扩展?<br>
卸载将会删除启用扩展后发布的所有文件及数据库, 且不可找回!!!<br> 卸载将会删除启用扩展后发布的所有文件及数据库, 且不可找回!!!<br>
@ -222,34 +222,34 @@ return [
</div> </div>
', ',
'filter_placeholder' => '输入扩展名称', 'filter_placeholder' => '输入扩展名称',
'form' => [ 'form' => [
'create_extension' => '创建扩展', 'create_extension' => '创建扩展',
'name' => '名称', 'name' => '名称',
'namespace' => '命名空间', 'namespace' => '命名空间',
'create_description' => '创建成功后会在 :dir 目录下创建基础的扩展目录结构', 'create_description' => '创建成功后会在 :dir 目录下创建基础的扩展目录结构',
], ],
'card' => [ 'card' => [
'author' => '作者', 'author' => '作者',
'version' => '版本', 'version' => '版本',
'homepage' => '主页', 'homepage' => '主页',
'status' => '状态', 'status' => '状态',
], ],
'status_map' => [ 'status_map' => [
'enabled' => '已启用', 'enabled' => '已启用',
'disabled' => '已禁用', 'disabled' => '已禁用',
], ],
'validation' => [ 'validation' => [
'file' => '请选择文件', 'file' => '请选择文件',
'invalid_package' => '无效的扩展包', 'invalid_package' => '无效的扩展包',
], ],
], ],
'export' => [ 'export' => [
'title' => '导出', 'title' => '导出',
'all' => '全部', 'all' => '全部',
'page' => '本页', 'page' => '本页',
'selected_rows' => '选中行', 'selected_rows' => '选中行',
'page_no_data' => '本页无数据', 'page_no_data' => '本页无数据',
'selected_rows_no_data' => '请选择要导出的数据', 'selected_rows_no_data' => '请选择要导出的数据',
'please_install_laravel_excel' => '请先安装 laravel-excel 扩展', 'please_install_laravel_excel' => '请先安装 laravel-excel 扩展',
], ],
]; ];

View File

@ -1,11 +1,11 @@
<?php <?php
return [ return [
'dashboard' => '控制台', 'dashboard' => '控制台',
'admin_system' => '系统管理', 'admin_system' => '系统管理',
'admin_users' => '管理员', 'admin_users' => '管理员',
'admin_roles' => '角色', 'admin_roles' => '角色',
'admin_permission' => '权限', 'admin_permission' => '权限',
'admin_menu' => '菜单', 'admin_menu' => '菜单',
'admin_setting' => '设置', 'admin_setting' => '设置',
]; ];