12 changed files with 1119 additions and 0 deletions
-
9app/AdminGuide/Controllers/AuthController.php
-
36app/AdminGuide/Controllers/HomeController.php
-
100app/AdminGuide/Metrics/Examples/NewDevices.php
-
108app/AdminGuide/Metrics/Examples/NewUsers.php
-
114app/AdminGuide/Metrics/Examples/ProductOrders.php
-
117app/AdminGuide/Metrics/Examples/Sessions.php
-
116app/AdminGuide/Metrics/Examples/Tickets.php
-
129app/AdminGuide/Metrics/Examples/TotalUsers.php
-
26app/AdminGuide/bootstrap.php
-
17app/AdminGuide/routes.php
-
346config/admin-guide.php
-
1config/admin.php
@ -0,0 +1,9 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\AdminGuide\Controllers; |
||||
|
|
||||
|
use Dcat\Admin\Http\Controllers\AuthController as BaseAuthController; |
||||
|
|
||||
|
class AuthController extends BaseAuthController |
||||
|
{ |
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\AdminGuide\Controllers; |
||||
|
|
||||
|
use App\AdminGuide\Metrics\Examples; |
||||
|
use App\Http\Controllers\Controller; |
||||
|
use Dcat\Admin\Http\Controllers\Dashboard; |
||||
|
use Dcat\Admin\Layout\Column; |
||||
|
use Dcat\Admin\Layout\Content; |
||||
|
use Dcat\Admin\Layout\Row; |
||||
|
|
||||
|
class HomeController extends Controller |
||||
|
{ |
||||
|
public function index(Content $content) |
||||
|
{ |
||||
|
return $content |
||||
|
->header('仪表盘') |
||||
|
->description('数据详情') |
||||
|
->body(function (Row $row) { |
||||
|
$row->column(6, function (Column $column) { |
||||
|
$column->row(Dashboard::title()); |
||||
|
$column->row(new Examples\Tickets()); |
||||
|
}); |
||||
|
|
||||
|
$row->column(6, function (Column $column) { |
||||
|
$column->row(function (Row $row) { |
||||
|
$row->column(6, new Examples\NewUsers()); |
||||
|
$row->column(6, new Examples\NewDevices()); |
||||
|
}); |
||||
|
|
||||
|
$column->row(new Examples\Sessions()); |
||||
|
$column->row(new Examples\ProductOrders()); |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,100 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\AdminGuide\Metrics\Examples; |
||||
|
|
||||
|
use Dcat\Admin\Admin; |
||||
|
use Dcat\Admin\Widgets\Metrics\Donut; |
||||
|
|
||||
|
class NewDevices extends Donut |
||||
|
{ |
||||
|
protected $labels = ['Desktop', 'Mobile']; |
||||
|
|
||||
|
/** |
||||
|
* 初始化卡片内容 |
||||
|
*/ |
||||
|
protected function init() |
||||
|
{ |
||||
|
parent::init(); |
||||
|
|
||||
|
$color = Admin::color(); |
||||
|
$colors = [$color->primary(), $color->alpha('blue2', 0.5)]; |
||||
|
|
||||
|
$this->title('New Devices'); |
||||
|
$this->subTitle('Last 30 days'); |
||||
|
$this->chartLabels($this->labels); |
||||
|
// 设置图表颜色
|
||||
|
$this->chartColors($colors); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 渲染模板 |
||||
|
* |
||||
|
* @return string |
||||
|
*/ |
||||
|
public function render() |
||||
|
{ |
||||
|
$this->fill(); |
||||
|
|
||||
|
return parent::render(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 写入数据. |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function fill() |
||||
|
{ |
||||
|
$this->withContent(44.9, 28.6); |
||||
|
|
||||
|
// 图表数据
|
||||
|
$this->withChart([44.9, 28.6]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 设置图表数据. |
||||
|
* |
||||
|
* @param array $data |
||||
|
* |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function withChart(array $data) |
||||
|
{ |
||||
|
return $this->chart([ |
||||
|
'series' => $data |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 设置卡片头部内容. |
||||
|
* |
||||
|
* @param mixed $desktop |
||||
|
* @param mixed $mobile |
||||
|
* |
||||
|
* @return $this |
||||
|
*/ |
||||
|
protected function withContent($desktop, $mobile) |
||||
|
{ |
||||
|
$blue = Admin::color()->alpha('blue2', 0.5); |
||||
|
|
||||
|
$style = 'margin-bottom: 8px'; |
||||
|
$labelWidth = 120; |
||||
|
|
||||
|
return $this->content( |
||||
|
<<<HTML |
||||
|
<div class="d-flex pl-1 pr-1 pt-1" style="{$style}"> |
||||
|
<div style="width: {$labelWidth}px"> |
||||
|
<i class="fa fa-circle text-primary"></i> {$this->labels[0]} |
||||
|
</div> |
||||
|
<div>{$desktop}</div> |
||||
|
</div> |
||||
|
<div class="d-flex pl-1 pr-1" style="{$style}"> |
||||
|
<div style="width: {$labelWidth}px"> |
||||
|
<i class="fa fa-circle" style="color: $blue"></i> {$this->labels[1]} |
||||
|
</div> |
||||
|
<div>{$mobile}</div> |
||||
|
</div> |
||||
|
HTML |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,108 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\AdminGuide\Metrics\Examples; |
||||
|
|
||||
|
use Dcat\Admin\Widgets\Metrics\Line; |
||||
|
use Illuminate\Http\Request; |
||||
|
|
||||
|
class NewUsers extends Line |
||||
|
{ |
||||
|
/** |
||||
|
* 初始化卡片内容 |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
protected function init() |
||||
|
{ |
||||
|
parent::init(); |
||||
|
|
||||
|
$this->title('New Users'); |
||||
|
$this->dropdown([ |
||||
|
'7' => 'Last 7 Days', |
||||
|
'28' => 'Last 28 Days', |
||||
|
'30' => 'Last Month', |
||||
|
'365' => 'Last Year', |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 处理请求 |
||||
|
* |
||||
|
* @param Request $request |
||||
|
* |
||||
|
* @return mixed|void |
||||
|
*/ |
||||
|
public function handle(Request $request) |
||||
|
{ |
||||
|
$generator = function ($len, $min = 10, $max = 300) { |
||||
|
for ($i = 0; $i <= $len; $i++) { |
||||
|
yield mt_rand($min, $max); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
switch ($request->get('option')) { |
||||
|
case '365': |
||||
|
// 卡片内容
|
||||
|
$this->withContent(mt_rand(1000, 5000).'k'); |
||||
|
// 图表数据
|
||||
|
$this->withChart(collect($generator(30))->toArray()); |
||||
|
break; |
||||
|
case '30': |
||||
|
// 卡片内容
|
||||
|
$this->withContent(mt_rand(400, 1000).'k'); |
||||
|
// 图表数据
|
||||
|
$this->withChart(collect($generator(30))->toArray()); |
||||
|
break; |
||||
|
case '28': |
||||
|
// 卡片内容
|
||||
|
$this->withContent(mt_rand(400, 1000).'k'); |
||||
|
// 图表数据
|
||||
|
$this->withChart(collect($generator(28))->toArray()); |
||||
|
break; |
||||
|
case '7': |
||||
|
default: |
||||
|
// 卡片内容
|
||||
|
$this->withContent('89.2k'); |
||||
|
// 图表数据
|
||||
|
$this->withChart([28, 40, 36, 52, 38, 60, 55,]); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 设置图表数据. |
||||
|
* |
||||
|
* @param array $data |
||||
|
* |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function withChart(array $data) |
||||
|
{ |
||||
|
return $this->chart([ |
||||
|
'series' => [ |
||||
|
[ |
||||
|
'name' => $this->title, |
||||
|
'data' => $data, |
||||
|
], |
||||
|
], |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 设置卡片内容. |
||||
|
* |
||||
|
* @param string $content |
||||
|
* |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function withContent($content) |
||||
|
{ |
||||
|
return $this->content( |
||||
|
<<<HTML |
||||
|
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px"> |
||||
|
<h2 class="ml-1 font-lg-1">{$content}</h2> |
||||
|
<span class="mb-0 mr-1 text-80">{$this->title}</span> |
||||
|
</div> |
||||
|
HTML |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,114 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\AdminGuide\Metrics\Examples; |
||||
|
|
||||
|
use Dcat\Admin\Widgets\Metrics\Round; |
||||
|
use Illuminate\Http\Request; |
||||
|
|
||||
|
class ProductOrders extends Round |
||||
|
{ |
||||
|
/** |
||||
|
* 初始化卡片内容 |
||||
|
*/ |
||||
|
protected function init() |
||||
|
{ |
||||
|
parent::init(); |
||||
|
|
||||
|
$this->title('Product Orders'); |
||||
|
$this->chartLabels(['Finished', 'Pending', 'Rejected']); |
||||
|
$this->dropdown([ |
||||
|
'7' => 'Last 7 Days', |
||||
|
'28' => 'Last 28 Days', |
||||
|
'30' => 'Last Month', |
||||
|
'365' => 'Last Year', |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 处理请求 |
||||
|
* |
||||
|
* @param Request $request |
||||
|
* |
||||
|
* @return mixed|void |
||||
|
*/ |
||||
|
public function handle(Request $request) |
||||
|
{ |
||||
|
switch ($request->get('option')) { |
||||
|
case '365': |
||||
|
case '30': |
||||
|
case '28': |
||||
|
case '7': |
||||
|
default: |
||||
|
// 卡片内容
|
||||
|
$this->withContent(23043, 14658, 4758); |
||||
|
|
||||
|
// 图表数据
|
||||
|
$this->withChart([70, 52, 26]); |
||||
|
|
||||
|
// 总数
|
||||
|
$this->chartTotal('Total', 344); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 设置图表数据. |
||||
|
* |
||||
|
* @param array $data |
||||
|
* |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function withChart(array $data) |
||||
|
{ |
||||
|
return $this->chart([ |
||||
|
'series' => $data, |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 卡片内容. |
||||
|
* |
||||
|
* @param int $finished |
||||
|
* @param int $pending |
||||
|
* @param int $rejected |
||||
|
* |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function withContent($finished, $pending, $rejected) |
||||
|
{ |
||||
|
return $this->content( |
||||
|
<<<HTML |
||||
|
<div class="col-12 d-flex flex-column flex-wrap text-center" style="max-width: 220px"> |
||||
|
<div class="chart-info d-flex justify-content-between mb-1 mt-2" > |
||||
|
<div class="series-info d-flex align-items-center"> |
||||
|
<i class="fa fa-circle-o text-bold-700 text-primary"></i> |
||||
|
<span class="text-bold-600 ml-50">Finished</span> |
||||
|
</div> |
||||
|
<div class="product-result"> |
||||
|
<span>{$finished}</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="chart-info d-flex justify-content-between mb-1"> |
||||
|
<div class="series-info d-flex align-items-center"> |
||||
|
<i class="fa fa-circle-o text-bold-700 text-warning"></i> |
||||
|
<span class="text-bold-600 ml-50">Pending</span> |
||||
|
</div> |
||||
|
<div class="product-result"> |
||||
|
<span>{$pending}</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="chart-info d-flex justify-content-between mb-1"> |
||||
|
<div class="series-info d-flex align-items-center"> |
||||
|
<i class="fa fa-circle-o text-bold-700 text-danger"></i> |
||||
|
<span class="text-bold-600 ml-50">Rejected</span> |
||||
|
</div> |
||||
|
<div class="product-result"> |
||||
|
<span>{$rejected}</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
HTML |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,117 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\AdminGuide\Metrics\Examples; |
||||
|
|
||||
|
use Dcat\Admin\Admin; |
||||
|
use Dcat\Admin\Widgets\Metrics\Bar; |
||||
|
use Illuminate\Http\Request; |
||||
|
|
||||
|
class Sessions extends Bar |
||||
|
{ |
||||
|
/** |
||||
|
* 初始化卡片内容 |
||||
|
*/ |
||||
|
protected function init() |
||||
|
{ |
||||
|
parent::init(); |
||||
|
|
||||
|
$color = Admin::color(); |
||||
|
|
||||
|
$dark35 = $color->dark35(); |
||||
|
|
||||
|
// 卡片内容宽度
|
||||
|
$this->contentWidth(5, 7); |
||||
|
// 标题
|
||||
|
$this->title('Avg Sessions'); |
||||
|
// 设置下拉选项
|
||||
|
$this->dropdown([ |
||||
|
'7' => 'Last 7 Days', |
||||
|
'28' => 'Last 28 Days', |
||||
|
'30' => 'Last Month', |
||||
|
'365' => 'Last Year', |
||||
|
]); |
||||
|
// 设置图表颜色
|
||||
|
$this->chartColors([ |
||||
|
$dark35, |
||||
|
$dark35, |
||||
|
$color->primary(), |
||||
|
$dark35, |
||||
|
$dark35, |
||||
|
$dark35 |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 处理请求 |
||||
|
* |
||||
|
* @param Request $request |
||||
|
* |
||||
|
* @return mixed|void |
||||
|
*/ |
||||
|
public function handle(Request $request) |
||||
|
{ |
||||
|
switch ($request->get('option')) { |
||||
|
case '7': |
||||
|
default: |
||||
|
// 卡片内容
|
||||
|
$this->withContent('2.7k', '+5.2%'); |
||||
|
|
||||
|
// 图表数据
|
||||
|
$this->withChart([ |
||||
|
[ |
||||
|
'name' => 'Sessions', |
||||
|
'data' => [75, 125, 225, 175, 125, 75, 25], |
||||
|
], |
||||
|
]); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 设置图表数据. |
||||
|
* |
||||
|
* @param array $data |
||||
|
* |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function withChart(array $data) |
||||
|
{ |
||||
|
return $this->chart([ |
||||
|
'series' => $data, |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 设置卡片内容. |
||||
|
* |
||||
|
* @param string $title |
||||
|
* @param string $value |
||||
|
* @param string $style |
||||
|
* |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function withContent($title, $value, $style = 'success') |
||||
|
{ |
||||
|
// 根据选项显示
|
||||
|
$label = strtolower( |
||||
|
$this->dropdown[request()->option] ?? 'last 7 days' |
||||
|
); |
||||
|
|
||||
|
$minHeight = '183px'; |
||||
|
|
||||
|
return $this->content( |
||||
|
<<<HTML |
||||
|
<div class="d-flex p-1 flex-column justify-content-between" style="padding-top: 0;width: 100%;height: 100%;min-height: {$minHeight}"> |
||||
|
<div class="text-left"> |
||||
|
<h1 class="font-lg-2 mt-2 mb-0">{$title}</h1> |
||||
|
<h5 class="font-medium-2" style="margin-top: 10px;"> |
||||
|
<span class="text-{$style}">{$value} </span> |
||||
|
<span>vs {$label}</span> |
||||
|
</h5> |
||||
|
</div> |
||||
|
|
||||
|
<a href="#" class="btn btn-primary shadow waves-effect waves-light">View Details <i class="feather icon-chevrons-right"></i></a> |
||||
|
</div> |
||||
|
HTML |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,116 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\AdminGuide\Metrics\Examples; |
||||
|
|
||||
|
use Dcat\Admin\Widgets\Metrics\RadialBar; |
||||
|
use Illuminate\Http\Request; |
||||
|
|
||||
|
class Tickets extends RadialBar |
||||
|
{ |
||||
|
/** |
||||
|
* 初始化卡片内容 |
||||
|
*/ |
||||
|
protected function init() |
||||
|
{ |
||||
|
parent::init(); |
||||
|
|
||||
|
$this->title('Tickets'); |
||||
|
$this->height(400); |
||||
|
$this->chartHeight(300); |
||||
|
$this->chartLabels('Completed Tickets'); |
||||
|
$this->dropdown([ |
||||
|
'7' => 'Last 7 Days', |
||||
|
'28' => 'Last 28 Days', |
||||
|
'30' => 'Last Month', |
||||
|
'365' => 'Last Year', |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 处理请求 |
||||
|
* |
||||
|
* @param Request $request |
||||
|
* |
||||
|
* @return mixed|void |
||||
|
*/ |
||||
|
public function handle(Request $request) |
||||
|
{ |
||||
|
switch ($request->get('option')) { |
||||
|
case '365': |
||||
|
case '30': |
||||
|
case '28': |
||||
|
case '7': |
||||
|
default: |
||||
|
// 卡片内容
|
||||
|
$this->withContent(162); |
||||
|
// 卡片底部
|
||||
|
$this->withFooter(29, 63, '1d'); |
||||
|
// 图表数据
|
||||
|
$this->withChart(83); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 设置图表数据. |
||||
|
* |
||||
|
* @param int $data |
||||
|
* |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function withChart(int $data) |
||||
|
{ |
||||
|
return $this->chart([ |
||||
|
'series' => [$data], |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 卡片内容 |
||||
|
* |
||||
|
* @param string $content |
||||
|
* |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function withContent($content) |
||||
|
{ |
||||
|
return $this->content( |
||||
|
<<<HTML |
||||
|
<div class="d-flex flex-column flex-wrap text-center"> |
||||
|
<h1 class="font-lg-2 mt-2 mb-0">{$content}</h1> |
||||
|
<small>Tickets</small> |
||||
|
</div> |
||||
|
HTML |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 卡片底部内容. |
||||
|
* |
||||
|
* @param string $new |
||||
|
* @param string $open |
||||
|
* @param string $response |
||||
|
* |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function withFooter($new, $open, $response) |
||||
|
{ |
||||
|
return $this->footer( |
||||
|
<<<HTML |
||||
|
<div class="d-flex justify-content-between p-1" style="padding-top: 0!important;"> |
||||
|
<div class="text-center"> |
||||
|
<p>New Tickets</p> |
||||
|
<span class="font-lg-1">{$new}</span> |
||||
|
</div> |
||||
|
<div class="text-center"> |
||||
|
<p>Open Tickets</p> |
||||
|
<span class="font-lg-1">{$open}</span> |
||||
|
</div> |
||||
|
<div class="text-center"> |
||||
|
<p>Response Time</p> |
||||
|
<span class="font-lg-1">{$response}</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
HTML |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,129 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\AdminGuide\Metrics\Examples; |
||||
|
|
||||
|
use Dcat\Admin\Widgets\Metrics\Card; |
||||
|
use Illuminate\Contracts\Support\Renderable; |
||||
|
use Illuminate\Http\Request; |
||||
|
|
||||
|
class TotalUsers extends Card |
||||
|
{ |
||||
|
/** |
||||
|
* 卡片底部内容. |
||||
|
* |
||||
|
* @var string|Renderable|\Closure |
||||
|
*/ |
||||
|
protected $footer; |
||||
|
|
||||
|
/** |
||||
|
* 初始化卡片. |
||||
|
*/ |
||||
|
protected function init() |
||||
|
{ |
||||
|
parent::init(); |
||||
|
|
||||
|
$this->title('Total Users'); |
||||
|
$this->dropdown([ |
||||
|
'7' => 'Last 7 Days', |
||||
|
'28' => 'Last 28 Days', |
||||
|
'30' => 'Last Month', |
||||
|
'365' => 'Last Year', |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 处理请求. |
||||
|
* |
||||
|
* @param Request $request |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function handle(Request $request) |
||||
|
{ |
||||
|
switch ($request->get('option')) { |
||||
|
case '365': |
||||
|
$this->content(mt_rand(600, 1500)); |
||||
|
$this->down(mt_rand(1, 30)); |
||||
|
break; |
||||
|
case '30': |
||||
|
$this->content(mt_rand(170, 250)); |
||||
|
$this->up(mt_rand(12, 50)); |
||||
|
break; |
||||
|
case '28': |
||||
|
$this->content(mt_rand(155, 200)); |
||||
|
$this->up(mt_rand(5, 50)); |
||||
|
break; |
||||
|
case '7': |
||||
|
default: |
||||
|
$this->content(143); |
||||
|
$this->up(15); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param int $percent |
||||
|
* |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function up($percent) |
||||
|
{ |
||||
|
return $this->footer( |
||||
|
"<i class=\"feather icon-trending-up text-success\"></i> {$percent}% Increase" |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param int $percent |
||||
|
* |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function down($percent) |
||||
|
{ |
||||
|
return $this->footer( |
||||
|
"<i class=\"feather icon-trending-down text-danger\"></i> {$percent}% Decrease" |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 设置卡片底部内容. |
||||
|
* |
||||
|
* @param string|Renderable|\Closure $footer |
||||
|
* |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function footer($footer) |
||||
|
{ |
||||
|
$this->footer = $footer; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 渲染卡片内容. |
||||
|
* |
||||
|
* @return string |
||||
|
*/ |
||||
|
public function renderContent() |
||||
|
{ |
||||
|
$content = parent::renderContent(); |
||||
|
|
||||
|
return <<<HTML |
||||
|
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px"> |
||||
|
<h2 class="ml-1 font-lg-1">{$content}</h2> |
||||
|
</div> |
||||
|
<div class="ml-1 mt-1 font-weight-bold text-80"> |
||||
|
{$this->renderFooter()} |
||||
|
</div> |
||||
|
HTML; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 渲染卡片底部内容. |
||||
|
* |
||||
|
* @return string |
||||
|
*/ |
||||
|
public function renderFooter() |
||||
|
{ |
||||
|
return $this->toString($this->footer); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
<?php |
||||
|
|
||||
|
use Dcat\Admin\Admin; |
||||
|
use Dcat\Admin\Grid; |
||||
|
use Dcat\Admin\Form; |
||||
|
use Dcat\Admin\Grid\Filter; |
||||
|
use Dcat\Admin\Show; |
||||
|
|
||||
|
/** |
||||
|
* Dcat-admin - admin builder based on Laravel. |
||||
|
* @author jqh <https://github.com/jqhph> |
||||
|
* |
||||
|
* Bootstraper for Admin. |
||||
|
* |
||||
|
* Here you can remove builtin form field: |
||||
|
* |
||||
|
* extend custom field: |
||||
|
* Dcat\Admin\Form::extend('php', PHPEditor::class); |
||||
|
* Dcat\Admin\Grid\Column::extend('php', PHPEditor::class); |
||||
|
* Dcat\Admin\Grid\Filter::extend('php', PHPEditor::class); |
||||
|
* |
||||
|
* Or require js and css assets: |
||||
|
* Admin::css('/packages/prettydocs/css/styles.css'); |
||||
|
* Admin::js('/packages/prettydocs/js/main.js'); |
||||
|
* |
||||
|
*/ |
||||
@ -0,0 +1,17 @@ |
|||||
|
<?php |
||||
|
|
||||
|
use Illuminate\Routing\Router; |
||||
|
use Illuminate\Support\Facades\Route; |
||||
|
use Dcat\Admin\Admin; |
||||
|
|
||||
|
Admin::routes(); |
||||
|
|
||||
|
Route::group([ |
||||
|
'prefix' => config('admin.route.prefix'), |
||||
|
'namespace' => config('admin.route.namespace'), |
||||
|
'middleware' => config('admin.route.middleware'), |
||||
|
], function (Router $router) { |
||||
|
|
||||
|
$router->get('/', 'HomeController@index'); |
||||
|
|
||||
|
}); |
||||
@ -0,0 +1,346 @@ |
|||||
|
<?php |
||||
|
|
||||
|
return [ |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| dcat-admin name |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| This value is the name of dcat-admin, This setting is displayed on the |
||||
|
| login page. |
||||
|
| |
||||
|
*/ |
||||
|
'name' => '地接管理后台', |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| dcat-admin logo |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| The logo of all admin pages. You can also set it as an image by using a |
||||
|
| `img` tag, eg '<img src="http://logo-url" alt="Admin logo">'. |
||||
|
| |
||||
|
*/ |
||||
|
'logo' => '<img src="/vendor/dcat-admin/images/logo.png" width="35"> Dcat Admin', |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| dcat-admin mini logo |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| The logo of all admin pages when the sidebar menu is collapsed. You can |
||||
|
| also set it as an image by using a `img` tag, eg |
||||
|
| '<img src="http://logo-url" alt="Admin logo">'. |
||||
|
| |
||||
|
*/ |
||||
|
'logo-mini' => '<img src="/vendor/dcat-admin/images/logo.png">', |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| User default avatar |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| Set a default avatar for newly created users. |
||||
|
| |
||||
|
*/ |
||||
|
'default_avatar' => '@admin/images/default-avatar.jpg', |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| dcat-admin route settings |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| The routing configuration of the admin page, including the path prefix, |
||||
|
| the controller namespace, and the default middleware. If you want to |
||||
|
| access through the root path, just set the prefix to empty string. |
||||
|
| |
||||
|
*/ |
||||
|
'route' => [ |
||||
|
'domain' => env('ADMIN_ROUTE_DOMAIN'), |
||||
|
|
||||
|
'prefix' => 'admin-guide', |
||||
|
|
||||
|
'namespace' => 'App\\AdminGuide\\Controllers', |
||||
|
|
||||
|
'middleware' => ['web', 'admin'], |
||||
|
], |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| dcat-admin install directory |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| The installation directory of the controller and routing configuration |
||||
|
| files of the administration page. The default is `app/Admin`, which must |
||||
|
| be set before running `artisan admin::install` to take effect. |
||||
|
| |
||||
|
*/ |
||||
|
'directory' => app_path('AdminGuide'), |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| dcat-admin html title |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| Html title for all pages. |
||||
|
| |
||||
|
*/ |
||||
|
'title' => '地接管理后台', |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| Assets hostname |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
*/ |
||||
|
'assets_server' => env('ADMIN_ASSETS_SERVER'), |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| Access via `https` |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| If your page is going to be accessed via https, set it to `true`. |
||||
|
| |
||||
|
*/ |
||||
|
'https' => env('ADMIN_HTTPS', false), |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| dcat-admin auth setting |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| Authentication settings for all admin pages. Include an authentication |
||||
|
| guard and a user provider setting of authentication driver. |
||||
|
| |
||||
|
| You can specify a controller for `login` `logout` and other auth routes. |
||||
|
| |
||||
|
*/ |
||||
|
'auth' => [ |
||||
|
'enable' => true, |
||||
|
|
||||
|
'controller' => App\AdminGuide\Controllers\AuthController::class, |
||||
|
|
||||
|
'guard' => 'admin-guide', |
||||
|
|
||||
|
'guards' => [ |
||||
|
'admin-guide' => [ |
||||
|
'driver' => 'session', |
||||
|
'provider' => 'admin-guide', |
||||
|
], |
||||
|
], |
||||
|
|
||||
|
'providers' => [ |
||||
|
'admin-guide' => [ |
||||
|
'driver' => 'eloquent', |
||||
|
'model' => Dcat\Admin\Models\Administrator::class, |
||||
|
], |
||||
|
], |
||||
|
|
||||
|
// Add "remember me" to login form
|
||||
|
'remember' => true, |
||||
|
|
||||
|
// All method to path like: auth/users/*/edit
|
||||
|
// or specific method to path like: get:auth/users.
|
||||
|
'except' => [ |
||||
|
'auth/login', |
||||
|
'auth/logout', |
||||
|
], |
||||
|
|
||||
|
], |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| The global Grid setting |
||||
|
|-------------------------------------------------------------------------- |
||||
|
*/ |
||||
|
'grid' => [ |
||||
|
|
||||
|
// The global Grid action display class.
|
||||
|
'grid_action_class' => Dcat\Admin\Grid\Displayers\DropdownActions::class, |
||||
|
|
||||
|
// The global Grid batch action display class.
|
||||
|
'batch_action_class' => Dcat\Admin\Grid\Tools\BatchActions::class, |
||||
|
|
||||
|
// The global Grid pagination display class.
|
||||
|
'paginator_class' => Dcat\Admin\Grid\Tools\Paginator::class, |
||||
|
|
||||
|
'actions' => [ |
||||
|
'view' => Dcat\Admin\Grid\Actions\Show::class, |
||||
|
'edit' => Dcat\Admin\Grid\Actions\Edit::class, |
||||
|
'quick_edit' => Dcat\Admin\Grid\Actions\QuickEdit::class, |
||||
|
'delete' => Dcat\Admin\Grid\Actions\Delete::class, |
||||
|
'batch_delete' => Dcat\Admin\Grid\Tools\BatchDelete::class, |
||||
|
], |
||||
|
|
||||
|
// The global Grid column selector setting.
|
||||
|
'column_selector' => [ |
||||
|
'store' => Dcat\Admin\Grid\ColumnSelector\SessionStore::class, |
||||
|
'store_params' => [ |
||||
|
'driver' => 'file', |
||||
|
], |
||||
|
], |
||||
|
], |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| dcat-admin helpers setting. |
||||
|
|-------------------------------------------------------------------------- |
||||
|
*/ |
||||
|
'helpers' => [ |
||||
|
'enable' => true, |
||||
|
], |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| dcat-admin permission setting |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| Permission settings for all admin pages. |
||||
|
| |
||||
|
*/ |
||||
|
'permission' => [ |
||||
|
// Whether enable permission.
|
||||
|
'enable' => true, |
||||
|
|
||||
|
// All method to path like: auth/users/*/edit
|
||||
|
// or specific method to path like: get:auth/users.
|
||||
|
'except' => [ |
||||
|
'/', |
||||
|
'auth/login', |
||||
|
'auth/logout', |
||||
|
'auth/setting', |
||||
|
], |
||||
|
|
||||
|
], |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| dcat-admin menu setting |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
*/ |
||||
|
'menu' => [ |
||||
|
'cache' => [ |
||||
|
// enable cache or not
|
||||
|
'enable' => false, |
||||
|
'store' => 'file', |
||||
|
], |
||||
|
|
||||
|
// Whether enable menu bind to a permission.
|
||||
|
'bind_permission' => true, |
||||
|
|
||||
|
// Whether enable role bind to menu.
|
||||
|
'role_bind_menu' => true, |
||||
|
|
||||
|
// Whether enable permission bind to menu.
|
||||
|
'permission_bind_menu' => true, |
||||
|
|
||||
|
'default_icon' => 'feather icon-circle', |
||||
|
], |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| dcat-admin upload setting |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| File system configuration for form upload files and images, including |
||||
|
| disk and upload path. |
||||
|
| |
||||
|
*/ |
||||
|
'upload' => [ |
||||
|
|
||||
|
// Disk in `config/filesystem.php`.
|
||||
|
'disk' => 'public', |
||||
|
|
||||
|
// Image and file upload path under the disk above.
|
||||
|
'directory' => [ |
||||
|
'image' => 'images', |
||||
|
'file' => 'files', |
||||
|
], |
||||
|
], |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| dcat-admin database settings |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| Here are database settings for dcat-admin builtin model & tables. |
||||
|
| |
||||
|
*/ |
||||
|
'database' => [ |
||||
|
|
||||
|
// Database connection for following tables.
|
||||
|
'connection' => '', |
||||
|
|
||||
|
// User tables and model.
|
||||
|
'users_table' => 'guides', |
||||
|
'users_model' => Dcat\Admin\Models\Administrator::class, |
||||
|
|
||||
|
// Role table and model.
|
||||
|
'roles_table' => 'admin_guide_roles', |
||||
|
'roles_model' => Dcat\Admin\Models\Role::class, |
||||
|
|
||||
|
// Permission table and model.
|
||||
|
'permissions_table' => 'admin_guide_permissions', |
||||
|
'permissions_model' => Dcat\Admin\Models\Permission::class, |
||||
|
|
||||
|
// Menu table and model.
|
||||
|
'menu_table' => 'admin_guide_menu', |
||||
|
'menu_model' => Dcat\Admin\Models\Menu::class, |
||||
|
|
||||
|
// Pivot table for table above.
|
||||
|
'role_users_table' => 'admin_guide_role_users', |
||||
|
'role_permissions_table' => 'admin_guide_role_permissions', |
||||
|
'role_menu_table' => 'admin_guide_role_menu', |
||||
|
'permission_menu_table' => 'admin_guide_permission_menu', |
||||
|
'settings_table' => 'admin_guide_settings', |
||||
|
'extensions_table' => 'admin_guide_extensions', |
||||
|
'extension_histories_table' => 'admin_guide_extension_histories', |
||||
|
], |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| Application layout |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| This value is the layout of admin pages. |
||||
|
*/ |
||||
|
'layout' => [ |
||||
|
// default, blue, blue-light, green
|
||||
|
'color' => 'blue-light', |
||||
|
|
||||
|
// sidebar-separate
|
||||
|
'body_class' => [], |
||||
|
|
||||
|
'horizontal_menu' => false, |
||||
|
|
||||
|
'sidebar_collapsed' => false, |
||||
|
|
||||
|
// light, primary, dark
|
||||
|
'sidebar_style' => 'light', |
||||
|
|
||||
|
'dark_mode_switch' => false, |
||||
|
|
||||
|
// bg-primary, bg-info, bg-warning, bg-success, bg-danger, bg-dark
|
||||
|
'navbar_color' => '', |
||||
|
], |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| The exception handler class |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
*/ |
||||
|
'exception_handler' => Dcat\Admin\Http\Exception\Handler::class, |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| Enable default breadcrumb |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| Whether enable default breadcrumb for every page content. |
||||
|
*/ |
||||
|
'enable_default_breadcrumb' => true, |
||||
|
]; |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue