first push

This commit is contained in:
2020-09-11 16:26:01 +08:00
commit fd2e97e190
1455 changed files with 358156 additions and 0 deletions

13
.gitignore vendored Normal file
View File

@@ -0,0 +1,13 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
.env
.env.backup
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log

View File

@@ -0,0 +1,97 @@
<?php
namespace App\Admin\Controllers\Advert;
use App\Models\Advert;
use App\Models\Category;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Controllers\AdminController;
class IndexController extends AdminController
{
protected $title = '图片管理';
/**
* Make a grid builder.
* @return Grid
*/
protected function grid()
{
return Grid::make(new Advert(['category']), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('cover', '图片')->image('', 60, 60);
$grid->column('category.title', '分类名称');
$grid->column('title', '图片名称');
$grid->column('url', '地址');
$grid->column('sort', '排序');
$grid->column('created_at');
$grid->column('updated_at')->sortable();
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('id');
$filter->like('title', '图片名称');
$filter->equal('category.id', '分类名称')->select(Category::selectOptions(function ($model) {
return $model->where('status', 1)->where('type', Category::TYPE_ADVERT);
}, '所有分类'));
});
});
}
/**
* Make a show builder.
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Advert(), function (Show $show) {
$show->field('id');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
* @return Form
*/
protected function form()
{
return Form::make(new Advert(), function (Form $form) {
$form->text('title', '图片名称')->required();
$form->select('category_id', '所属分类')
->options(Category::selectOptions(function ($model) {
return $model->where('status', 1)->where('type', Category::TYPE_ADVERT);
}, '选择分类'))
->rules('required|min:1', [
'required' => '必须选择所属分类',
'min' => '必须选择所属分类',
]);
$form->image('cover', '封面图片')
->move('images/' . date('Y/m/d'))
->uniqueName();
// $form->image('cover', '封面图片')
// ->rules(function ($form) {
// if ($form->model()->cover != []) {
// return 'nullable|image';
// } else {
// return 'required';
// }
// })
// ->move('images/' . date('Y/m/d'))
// ->removable()
// ->uniqueName();
$form->text('url', '链接地址');
$form->number('sort', '排序')
->default(1)
->required()
->help('数字越大越靠前');
});
}
}

View File

@@ -0,0 +1,93 @@
<?php
namespace App\Admin\Controllers\Article;
use App\Models\Article;
use App\Models\Category;
use Dcat\Admin\Controllers\AdminController;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
class IndexController extends AdminController
{
protected $title = '内容管理';
/**
* Make a grid builder.
* @return Grid
*/
protected function grid()
{
return Grid::make(new Article(['category']), function (Grid $grid) {
$grid->column('id', '#ID#');
$grid->column('cover', '封面图片')->image('', 60, 60);
$grid->column('category.title', '所属分类');
$grid->column('title', '文章标题');
$grid->column('sort', '序号');
$grid->status('状态')->switch();
$grid->column('created_at', '创建时间');
$grid->filter(function (Grid\Filter $filter) {
$filter->like('title', '文章标题');
$filter->equal('category.id', '所属分类')->select(Category::selectOptions(function ($model) {
return $model->where('status', 1)->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]);
}, '所有分类'));
});
});
}
/**
* Make a show builder.
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Article(), function (Show $show) {
$show->field('id');
$show->field('title');
$show->field('category_id');
$show->field('description');
$show->field('cover');
$show->field('content');
$show->field('status');
$show->field('sort');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
* @return Form
*/
protected function form()
{
return Form::make(new Article(), function (Form $form) {
$form->text('title', '文章标题')->rules('min:2');
$form->select('category_id', '所属分类')
->options(Category::selectOptions(function ($model) {
return $model->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]);
}, '选择分类'))
->rules('required|min:1', [
'required' => '必须选择所属分类',
'min' => '必须选择所属分类',
]);
$form->textarea('description', '内容简介')->rules('max:350');
$form->image('cover', '封面')
->move('images/' . date('Y/m/d'))
->uniqueName();
$form->editor('content', '文章内容')->rules('required', ['required' => '详情不能为空']);
$form->number('sort', '序号')->default(0)->rules('required', ['required' => '序号必须填写'])->help('倒序优先');
$form->switch('status', '状态')->default(1);
});
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace App\Admin\Controllers;
use Dcat\Admin\Controllers\AuthController as BaseAuthController;
class AuthController extends BaseAuthController
{
}

View File

@@ -0,0 +1,125 @@
<?php
namespace App\Admin\Controllers\Category;
use App\Models\Article;
use App\Models\Category;
use Dcat\Admin\Form;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Row;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Tree;
use Dcat\Admin\Controllers\AdminController;
use Dcat\Admin\Widgets\Form as WidgetForm;
use Dcat\Admin\Widgets\Box;
class IndexController extends AdminController
{
protected $title = '分类管理';
public function index(Content $content)
{
return $content->header('树状模型')
->body(function (Row $row) {
$row->column(6, $this->treeView()->render());
$row->column(6, function (Column $column) {
$form = new WidgetForm();
$form->select('parent_id', '上级分类')
->options(Category::selectOptions(function ($model) {
return $model->where('status', 1);
}, '一级分类'))
->required();
$form->text('title', '分类名称')->rules('required');
$form->select('type', '分类类型')
->options(Category::TYPES)
->when('show', function (WidgetForm $form) {
$form->select('article_id', '关联文章')
->options(function ($option, $info) {
return Article::whereHas('category', function ($q) {
$q->where('type', 'show');
})->pluck('title', 'id');
})->help('当分类类型是文章详情的时候需要选择关联文章');
})
->required();
$form->textarea('description', '分类简介')
->rules('nullable');
$form->text('keywords', '关键词')->rules('nullable');
$form->image('cover', '封面图片')
->move('images/' . date('Y/m/d'))
->uniqueName();
$form->number('order', '排序')->default(0);
$form->switch('top_show', '顶部导航显示');
$form->switch('status', '显示')->default(1);
$form->action(admin_url('categories'));
$column->append((new Box('新增分类', $form))->style('success'));
});
});
}
protected function treeView()
{
return new Tree(new Category, function (Tree $tree) {
$tree->disableCreateButton();
$tree->disableQuickCreateButton();
$tree->disableEditButton();
$tree->branch(function ($branch) {
if ($branch['status'] == 1) {
$payload = "<i class='fa fa-eye text-primary'></i> ";
} else {
$payload = "<i class='fa fa-eye text-gray'></i> ";
}
$payload .= " [ID:{$branch['id']}] - ";
$payload .= " <strong>{$branch['title']}</strong> ";
$payload .= " <small>{$branch['type']}</small> ";
$payload .= " <small style='color:#999'>{$branch['description']}</small>";
return $payload;
});
});
}
protected function form()
{
return Form::make(new Category(), function (Form $form) {
$form->select('parent_id', '上级分类')->options(Category::selectOptions(function ($model) {
return $model->where('status', 1);
}, '一级分类'));
$form->text('title', '分类名称')->rules('required');
$form->select('type', '分类类型')
->options(Category::TYPES)
->when('show', function (Form $form) {
$form->select('article_id', '关联文章')
->options(function ($option, $info) {
return Article::whereHas('category', function ($q) {
$q->where('type', 'show');
})->pluck('title', 'id');
})->help('当分类类型是文章详情的时候需要选择关联文章');
})
->required();
$form->textarea('description', '分类简介')->rows(4)->rules('nullable');
$form->text('keywords', '关键词')->rules('nullable');
$form->image('cover', 'Logo')
->move('images/' . date('Y/m/d'))
->uniqueName();
$form->number('order', '排序')->default(0)->help('正序优先');
$form->switch('top_show', '顶部导航显示');
$form->switch('status', '显示')->default(1);
});
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Admin\Controllers\File;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Controllers\AdminController;
use App\Models\File;
class IndexController extends AdminController
{
protected $title = '模板管理';
/**
* Make a grid builder.
* @return Grid
*/
protected function grid()
{
return Grid::make(new File(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('title', '文件名称');
$grid->column('cover', '地址');
$grid->status('状态')->switch();
$grid->column('created_at');
});
}
/**
* Make a form builder.
* @return Form
*/
protected function form()
{
return Form::make(new File(), function (Form $form) {
$form->text('title', '文件名称');
$form->file('cover', '文件')
->move('file/' . date('Y/m/d'))
->uniqueName()
->required();
});
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Admin\Controllers;
use App\Admin\Metrics\Examples;
use App\Http\Controllers\Controller;
use Dcat\Admin\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('Dashboard')
->description('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());
});
});
}
}

View File

@@ -0,0 +1,68 @@
<?php
namespace App\Admin\Controllers\Link;
use App\Models\Link;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Controllers\AdminController;
class IndexController extends AdminController
{
protected $title = '友情链接';
/**
* Make a grid builder.
* @return Grid
*/
protected function grid()
{
return Grid::make(new Link(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('title');
$grid->column('url');
$grid->column('created_at');
$grid->column('updated_at')->sortable();
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('id');
});
});
}
/**
* Make a show builder.
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Link(), function (Show $show) {
$show->field('id');
$show->field('title');
$show->field('url');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
* @return Form
*/
protected function form()
{
return Form::make(new Link(), function (Form $form) {
$form->display('id');
$form->text('title');
$form->text('url');
$form->display('created_at');
$form->display('updated_at');
});
}
}

View File

@@ -0,0 +1,100 @@
<?php
namespace App\Admin\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
);
}
}

View File

@@ -0,0 +1,108 @@
<?php
namespace App\Admin\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
);
}
}

View File

@@ -0,0 +1,114 @@
<?php
namespace App\Admin\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
);
}
}

View File

@@ -0,0 +1,117 @@
<?php
namespace App\Admin\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
);
}
}

View File

@@ -0,0 +1,116 @@
<?php
namespace App\Admin\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
);
}
}

View File

@@ -0,0 +1,129 @@
<?php
namespace App\Admin\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);
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Admin\Repositories;
use App\Models\Advert as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Advert extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Admin\Repositories;
use App\Models\Article as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Article extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Admin\Repositories;
use App\Models\Category as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Category extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Admin\Repositories;
use App\Models\File as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class File extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Admin\Repositories;
use App\Models\Link as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Link extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}

View File

@@ -0,0 +1,12 @@
<?php
use Illuminate\Routing\Router;
Route::group([
'prefix' => config('admin.route.prefix'),
'namespace' => config('admin.route.namespace') . '\\Advert',
'middleware' => config('admin.route.middleware'),
], function (Router $router) {
$router->resource('adverts', 'IndexController');
});

View File

@@ -0,0 +1,11 @@
<?php
use Illuminate\Routing\Router;
Route::group([
'prefix' => config('admin.route.prefix'),
'namespace' => config('admin.route.namespace') . '\\Article',
'middleware' => config('admin.route.middleware'),
], function (Router $router) {
$router->resource('articles', 'IndexController');
});

View File

@@ -0,0 +1,12 @@
<?php
use Illuminate\Routing\Router;
Route::group([
'prefix' => config('admin.route.prefix'),
'namespace' => config('admin.route.namespace') . '\\Category',
'middleware' => config('admin.route.middleware'),
], function (Router $router) {
$router->resource('categories', 'IndexController');
});

12
app/Admin/Routes/file.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
use Illuminate\Routing\Router;
Route::group([
'prefix' => config('admin.route.prefix'),
'namespace' => config('admin.route.namespace') . '\\File',
'middleware' => config('admin.route.middleware'),
], function (Router $router) {
$router->resource('files', 'IndexController');
});

12
app/Admin/Routes/link.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
use Illuminate\Routing\Router;
Route::group([
'prefix' => config('admin.route.prefix'),
'namespace' => config('admin.route.namespace') . '\\Link',
'middleware' => config('admin.route.middleware'),
], function (Router $router) {
$router->resource('links', 'IndexController');
});

44
app/Admin/bootstrap.php Normal file
View File

@@ -0,0 +1,44 @@
<?php
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\Filter;
/**
* 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');
*/
Form::resolving(function (Form $form) {
$form->disableEditingCheck();
$form->disableCreatingCheck();
$form->disableViewCheck();
$form->tools(function (Form\Tools $tools) {
$tools->disableDelete();
// $tools->disableView();
$tools->disableList();
});
});
Grid::resolving(function (Grid $grid) {
$grid->actions(function (Grid\Displayers\Actions $actions) {
$actions->disableView();
});
$grid->disableBatchActions();
$grid->filter(function ($filter) {
$filter->disableIdFilter();
});
});

23
app/Admin/routes.php Normal file
View File

@@ -0,0 +1,23 @@
<?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');
});
require __DIR__ . '/Routes/article.php';
require __DIR__ . '/Routes/category.php';
require __DIR__ . '/Routes/link.php';
require __DIR__ . '/Routes/advert.php';
require __DIR__ . '/Routes/file.php';

41
app/Console/Kernel.php Normal file
View File

@@ -0,0 +1,41 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
//
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Http\Controllers;
use App\Models\Article;
use App\Models\Category;
use Illuminate\Http\Request;
class ArticleController extends Controller
{
//文章列表
public function index(Category $category)
{
$articles = Article::where('category_id', $category->id)
->orderBy('created_at', 'desc')
->paginate(5);
return view('articles.index', compact('articles', 'category'));
}
//显示详情
public function show(Article $article)
{
if ($article->url) {
return redirect($article->url);
}
$category = $article->category;
$next = Article::where('id', '>', $article->id)->where('status', 1)->first();
return view('articles.show', compact('article', 'category', 'next'));
}
//搜索
public function search(Request $request)
{
$title = $request->title;
$articles = Article::where('status', 1)
->when($title, function ($q) use ($title) {
$q->where('title', 'like', "%{$title}%");
})
->paginate();
return view('articles.search', compact('articles'));
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Http\Controllers;
use App\Models\Category;
use App\Models\Link;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\View;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
public function __construct()
{
//顶部分类
$categorys = Category::where('parent_id', 0)
->where('status', 1)
->where('top_show', 1)
->select('id', 'title', 'type', 'order', 'article_id')
->orderBy('order', 'asc')
->get();
$links = Link::get();
View::share('all_categorys', $categorys);
View::share('links', $links);
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Http\Controllers;
use App\Models\Advert;
use App\Models\File;
class IndexController extends Controller
{
/**
* Notes: 首页
* @Author: 玄尘
* @Date : 2020/6/1 9:11
*/
public function index()
{
$adverts = Advert::where('category_id', 7)->latest()->get();
$file = File::where('status', 1)->latest()->first();
return view('index.index', compact('adverts', 'file'));
}
}

66
app/Http/Kernel.php Normal file
View File

@@ -0,0 +1,66 @@
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
//
];
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null ...$guards
* @return mixed
*/
public function handle($request, Closure $next, ...$guards)
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
}
return $next($request);
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
'password',
'password_confirmation',
];
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Http\Middleware;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array|string|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
//
];
}

13
app/Models/Advert.php Normal file
View File

@@ -0,0 +1,13 @@
<?php
namespace App\Models;
use App\Models\Traits\BelongsToCategory;
use App\Models\Traits\HasOneCover;
class Advert extends Model
{
use HasOneCover,
BelongsToCategory;
}

18
app/Models/Article.php Normal file
View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use App\Models\Traits\BelongsToCategory;
use App\Models\Traits\HasOneCover;
class Article extends Model
{
use HasOneCover, BelongsToCategory;
public function getLinkAttribute()
{
return route('article.show', $this);
}
}

60
app/Models/Category.php Normal file
View File

@@ -0,0 +1,60 @@
<?php
namespace App\Models;
use App\Models\Traits\HasOneCover;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Dcat\Admin\Traits\ModelTree;
class Category extends Model
{
use HasOneCover, ModelTree;
public const TYPE_SHOW = 'show';
public const TYPE_ARTICLE = 'article';
public const TYPE_ADVERT = 'advert';
public const TYPES = [
self::TYPE_ARTICLE => '文章列表',
self::TYPE_SHOW => '文章详情',
self::TYPE_ADVERT => '图片',
];
public function getLinkAttribute()
{
return route('category.show', $this);
}
/**
* 关联的数据
* @return [type] [description]
*/
public function relations()
{
switch ($this->type) {
case self::TYPE_SHOW:
return $this->hasOne(Article::class, 'id', 'article_id');
break;
case self::TYPE_ARTICLE:
return $this->hasMany(Article::class);
break;
case self::TYPE_ADVERT:
return $this->hasMany(Advert::class);
break;
default:
return null;
}
}
public function parent(): BelongsTo
{
return $this->belongsTo(__CLASS__)->withDefault(['name' => '顶级分类']);
}
public function children(): HasMany
{
return $this->hasMany(__CLASS__, 'parent_id');
}
}

17
app/Models/File.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use App\Models\Traits\HasOneCover;
class File extends Model
{
use HasOneCover;
public function getDownloadPathAttribute()
{
return env('APP_URL') . $this->cover_path;
}
}

8
app/Models/Link.php Normal file
View File

@@ -0,0 +1,8 @@
<?php
namespace App\Models;
class Link extends Model
{
//
}

13
app/Models/Model.php Normal file
View File

@@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model as Eloquent;
class Model extends Eloquent
{
use HasDateTimeFormatter;
protected $guarded = [];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models\Traits;
use App\Models\Category;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
trait BelongsToCategory
{
/**
* 关联分类表
* @author 玄尘 2020-03-05
* @return BelongsTo
*/
public function category(): BelongsTo
{
return $this->belongsTo(Category::class)->withDefault();
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models\Traits;
use Illuminate\Support\Facades\Storage;
trait HasOneCover
{
/**
* 拼接图片全地址
* @author 玄尘 2020-03-05
* @return string
*/
public function getCoverPathAttribute(): ?string
{
if ($this->cover) {
return Storage::url($this->cover);
} else {
return '';
}
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
\Schema::defaultStringLength(191);
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
// 'App\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
//
}
}

View File

@@ -0,0 +1,61 @@
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
*
* This is used by Laravel authentication to redirect users after login.
*
* @var string
*/
public const HOME = '/home';
/**
* If specified, this namespace is automatically applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = null;
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::middleware('web')
->group(base_path('routes/web.php'));
Route::prefix('api')
->middleware('api')
->group(base_path('routes/api.php'));
});
}
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60);
});
}
}

53
artisan Normal file
View File

@@ -0,0 +1,53 @@
#!/usr/bin/env php
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$kernel->terminate($input, $status);
exit($status);

55
bootstrap/app.php Normal file
View File

@@ -0,0 +1,55 @@
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;

2
bootstrap/cache/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

62
composer.json Normal file
View File

@@ -0,0 +1,62 @@
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.3",
"dcat/laravel-admin": "^1.7",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.0",
"laravel/tinker": "^2.0"
},
"require-dev": {
"facade/ignition": "^2.3.6",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}

8213
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

379
config/admin.php Normal file
View File

@@ -0,0 +1,379 @@
<?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="/vendors/dcat-admin/images/logo.png" width="35"> &nbsp;自动化技术与应用',
/*
|--------------------------------------------------------------------------
| 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="/vendors/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' => [
'prefix' => env('ADMIN_ROUTE_PREFIX', 'admin'),
'namespace' => 'App\\Admin\\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('Admin'),
/*
|--------------------------------------------------------------------------
| dcat-admin html title
|--------------------------------------------------------------------------
|
| Html title for all pages.
|
*/
'title' => 'Admin',
/*
|--------------------------------------------------------------------------
| 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\Admin\Controllers\AuthController::class,
'guard' => 'admin',
'guards' => [
'admin' => [
'driver' => 'session',
'provider' => 'admin',
],
],
'providers' => [
'admin' => [
'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',
],
],
'grid' => [
/*
|--------------------------------------------------------------------------
| The global Grid action display class.
|--------------------------------------------------------------------------
*/
'grid_action_class' => Dcat\Admin\Grid\Displayers\DropdownActions::class,
],
/*
|--------------------------------------------------------------------------
| 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,
],
/*
|--------------------------------------------------------------------------
| 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' => 'admin',
// 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' => 'admin_users',
'users_model' => Dcat\Admin\Models\Administrator::class,
// Role table and model.
'roles_table' => 'admin_roles',
'roles_model' => Dcat\Admin\Models\Role::class,
// Permission table and model.
'permissions_table' => 'admin_permissions',
'permissions_model' => Dcat\Admin\Models\Permission::class,
// Menu table and model.
'menu_table' => 'admin_menu',
'menu_model' => Dcat\Admin\Models\Menu::class,
// Pivot table for table above.
'operation_log_table' => 'admin_operation_log',
'role_users_table' => 'admin_role_users',
'role_permissions_table' => 'admin_role_permissions',
'role_menu_table' => 'admin_role_menu',
'permission_menu_table' => 'admin_permission_menu',
],
/*
|--------------------------------------------------------------------------
| User operation log setting
|--------------------------------------------------------------------------
|
| By setting this option to open or close operation log in dcat-admin.
|
*/
'operation_log' => [
'enable' => true,
// Only logging allowed methods in the list
'allowed_methods' => ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'],
'secret_fields' => [
'password',
'password_confirmation',
],
// Routes that will not log to database.
// All method to path like: auth/logs/*/edit
// or specific method to path like: get:auth/logs.
'except' => [
'auth/logs*',
],
],
/*
|--------------------------------------------------------------------------
| Admin map field provider
|--------------------------------------------------------------------------
|
| Supported: "tencent", "google", "yandex", "baidu".
|
*/
'map' => [
'provider' => 'baidu',
'keys' => [
'tencent' => env('TENCENT_MAP_API_KEY'),
'google' => env('GOOGLE_API_KEY'),
'baidu' => env('BAIDU_MAP_API_KEY'),
],
],
/*
|--------------------------------------------------------------------------
| Application layout
|--------------------------------------------------------------------------
|
| This value is the layout of admin pages.
*/
'layout' => [
// indigo, blue, blue-light, blue-dark, green
'color' => 'indigo',
'body_class' => '',
'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\Exception\Handler::class,
/*
|--------------------------------------------------------------------------
| Enable default breadcrumb
|--------------------------------------------------------------------------
|
| Whether enable default breadcrumb for every page content.
*/
'enable_default_breadcrumb' => true,
/*
|--------------------------------------------------------------------------
| Extension Directory
|--------------------------------------------------------------------------
|
| When you use command `php artisan admin:extend` to generate extensions,
| the extension files will be generated in this directory.
*/
'extension_dir' => app_path('Admin/Extensions'),
/*
|--------------------------------------------------------------------------
| Settings for extensions.
|--------------------------------------------------------------------------
|
| You can find all available extensions here
| https://github.com/dcat-admin-extensions.
|
*/
'extensions' => [
],
];

232
config/app.php Normal file
View File

@@ -0,0 +1,232 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL', null),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'PRC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'zh-CN',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Arr' => Illuminate\Support\Arr::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Http' => Illuminate\Support\Facades\Http::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'Str' => Illuminate\Support\Str::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
],
];

117
config/auth.php Normal file
View File

@@ -0,0 +1,117 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
'hash' => false,
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];

59
config/broadcasting.php Normal file
View File

@@ -0,0 +1,59 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'useTLS' => true,
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];

104
config/cache.php Normal file
View File

@@ -0,0 +1,104 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb"
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
];

34
config/cors.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];

147
config/database.php Normal file
View File

@@ -0,0 +1,147 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];

92
config/filesystems.php Normal file
View File

@@ -0,0 +1,92 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'admin' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
],
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

52
config/hashing.php Normal file
View File

@@ -0,0 +1,52 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 1024,
'threads' => 2,
'time' => 2,
],
];

104
config/logging.php Normal file
View File

@@ -0,0 +1,104 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => 'critical',
],
'papertrail' => [
'driver' => 'monolog',
'level' => 'debug',
'handler' => SyslogUdpHandler::class,
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => 'debug',
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

110
config/mail.php Normal file
View File

@@ -0,0 +1,110 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'auth_mode' => null,
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => '/usr/sbin/sendmail -bs',
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];

89
config/queue.php Normal file
View File

@@ -0,0 +1,89 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 90,
'block_for' => 0,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'your-queue-name'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90,
'block_for' => null,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];

33
config/services.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
],
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
];

201
config/session.php Normal file
View File

@@ -0,0 +1,201 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION', null),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE', null),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" since this is a secure default value.
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => 'lax',
];

36
config/view.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];

2
database/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*.sqlite
*.sqlite-journal

View File

@@ -0,0 +1,33 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class UserFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->name,
'email' => $this->faker->unique()->safeEmail,
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
];
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}

View File

@@ -0,0 +1,122 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAdminTables extends Migration
{
public function getConnection()
{
return config('database.connection') ?: config('database.default');
}
public function config($key)
{
return config('admin.'.$key);
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create($this->config('database.users_table'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('username', 120)->unique();
$table->string('password', 80);
$table->string('name');
$table->string('avatar')->nullable();
$table->string('remember_token', 100)->nullable();
$table->timestamps();
});
Schema::create($this->config('database.roles_table'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name', 50);
$table->string('slug', 50)->unique();
$table->timestamps();
});
Schema::create($this->config('database.permissions_table'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name', 50);
$table->string('slug', 50)->unique();
$table->string('http_method')->nullable();
$table->text('http_path')->nullable();
$table->integer('order')->default(0);
$table->bigInteger('parent_id')->default(0);
$table->timestamps();
});
Schema::create($this->config('database.menu_table'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('parent_id')->default(0);
$table->integer('order')->default(0);
$table->string('title', 50);
$table->string('icon', 50)->nullable();
$table->string('uri', 50)->nullable();
$table->timestamps();
});
Schema::create($this->config('database.role_users_table'), function (Blueprint $table) {
$table->bigInteger('role_id');
$table->bigInteger('user_id');
$table->unique(['role_id', 'user_id']);
$table->timestamps();
});
Schema::create($this->config('database.role_permissions_table'), function (Blueprint $table) {
$table->bigInteger('role_id');
$table->bigInteger('permission_id');
$table->unique(['role_id', 'permission_id']);
$table->timestamps();
});
Schema::create($this->config('database.role_menu_table'), function (Blueprint $table) {
$table->bigInteger('role_id');
$table->bigInteger('menu_id');
$table->unique(['role_id', 'menu_id']);
$table->timestamps();
});
Schema::create($this->config('database.permission_menu_table'), function (Blueprint $table) {
$table->bigInteger('permission_id');
$table->bigInteger('menu_id');
$table->unique(['permission_id', 'menu_id']);
$table->timestamps();
});
Schema::create($this->config('database.operation_log_table'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('user_id');
$table->string('path');
$table->string('method', 10);
$table->string('ip');
$table->text('input');
$table->index('user_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists($this->config('database.users_table'));
Schema::dropIfExists($this->config('database.roles_table'));
Schema::dropIfExists($this->config('database.permissions_table'));
Schema::dropIfExists($this->config('database.menu_table'));
Schema::dropIfExists($this->config('database.role_users_table'));
Schema::dropIfExists($this->config('database.role_permissions_table'));
Schema::dropIfExists($this->config('database.role_menu_table'));
Schema::dropIfExists($this->config('database.permission_menu_table'));
Schema::dropIfExists($this->config('database.operation_log_table'));
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
// User::factory(10)->create();
}
}

21
public/.htaccess Normal file
View File

@@ -0,0 +1,21 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

View File

@@ -0,0 +1,604 @@
@charset "utf-8";
/* CSS Document */
*{ margin:0; padding:0}
ul li{ list-style:none}
img{ border:0; max-width:100%}
a{ text-decoration:none; color:#333}
body{ font-family:"微软雅黑"; width:100%; min-width:1200px;color: #333;font-size: 14px;}
p{text-align:justify}
/*
公告样式
*/
.ce-white {
background: #fff;
}
.contant {
width: 1200px;
margin: 0 auto;
}
.ce-morgin-tb {
margin: 30px 0;
}
.ce-img {
position: relative;
}
.ce-img>span {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.ce-nowrap {
max-width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis
}
.ce-nowrap-multi {
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2
}
/*
首页公告
*/
.notice {
height: 50px;
line-height: 50px;
overflow: hidden;
background-color: #f5f5f5;
overflow: hidden;
}
.notice-left {
float: left;
width: 400px;
display: flex;
color: #929191;
}
.notice-name {
display: flex;
width: 160px;
}
.notice-name img {
width: 20px;
height: 20px;
margin: 14px 10px 0 0;
}
.notice-container {
height: 40px;
color: #616161;
cursor: pointer;
}
.notice-right {
float: right;
color: #5f5f5f;
}
.notice-right>span {
padding-left: 10px;
cursor: pointer;
}
/*
首页头部
*/
.idxNav {
background-image: url(../images/nav_back.png);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
width: 100%;
}
.idxTop {
padding: 20px 0;
box-sizing: border-box;
position: relative;
}
.idxLogo {
width: 300px;
cursor: pointer;
}
.idxNav-li {
position: absolute;
left: 400px;
top: 20px;
width: calc(100% - 400px);
display: flex;
}
.idxNav-li li {
padding: 5px 25px 0;
color: #fff;
font-size: 16px;
cursor: pointer;
line-height: 38px;
position: relative;
transition: .2s;
}
.idxNav-li li::after {
position: absolute;
content: '';
left: 50%;
bottom: 0;
background: transparent;
width: 0;
height: 2px;
transition: .2s;
}
.idxNav-li li.active::after, .idxNav-li li:hover::after {
background: #fff;
width: 40%;
left: 30%;
}
/*
首页第一模块
*/
.idxOne .content {
display: flex;
}
.idxBanner {
width: 800px;
}
.idxOneCont {
width: calc(400px - 20px);
margin-left: 20px;
background-color: #fff;
box-shadow: 0 0 .5rem rgba(0,0,0,.2);
border-radius: .5rem;
overflow: hidden;
}
.idxOneCont-top {
padding: 1rem;
box-sizing: border-box;
position: relative;
height: 50%;
}
.idxOneCont-img {
width: 120px;
height: 160px;
}
.idxOneCont-img>span {
background-size: 100% 100%;
}
.idxOneCont-text {
position: absolute;
top: 30px;
left: 150px;
right: 10px;
width: calc(100% - 160px);
}
.idxOneCont-text>div{
color: #4f4f4f;
display: flex;
margin: .5rem 0;
}
.idxOneCont-text>div>span{
display: inline-block;
width: 3rem;
}
.idxOneCont-text>div>p{
width: calc(100% - 3rem)
}
.idxOneCont-tool {
background-image: url(../images/idxOne_back.png);
width: 100%;
text-align: center;
color: #fff;
height: 50%;
padding: 2rem 0;
box-sizing: border-box;
}
.idxOneCont-tool>div {
font-size: 1.4rem;
}
.idxOneCont-tool>span {
font-size: 1.4rem;
margin-top: 1rem;
display: block;
}
.idxBanner-img {
height: 380px;
width: 100%;
cursor: pointer;
}
.idxBanner-img>p {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 40px;
line-height: 40px;
background-color: rgba(0,0,0,.4);
color: #fff;
padding: 0 30px;
box-sizing: border-box;
}
.idxOne .swiper-container-horizontal>.swiper-pagination-bullets, .idxOne .swiper-pagination-custom, .idxOne .swiper-pagination-fraction {
bottom: 15px;
text-align: end;
width:98%;
}
.swiper-container-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet {
margin: 0 10px 0 0;
}
.swiper-container-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet {
background-color: #fff;
opacity: 1;
}
.swiper-pagination-bullet-active {
background-color: #0069d2 !important;
}
.idxBanner-next, .idxBanner-prev{
background-color: rgba(0,0,0,.3);
position: absolute;
top: calc(50% - 25px);
width: 42px;
height: 70px;
z-index: 99;
}
.idxBanner-next {
right: 0;
}
.idxBanner-prev {
left: 0;
}
.idxBanner-next .swiper-button-next {
background-image: url(../images/next.png);
opacity: 1;
}
.idxBanner-prev .swiper-button-prev {
background-image: url(../images/prev.png);
opacity: 1;
}
/*
首页第二模块
*/
.idxTwo-title{
text-align: center;
font-size: 1.4rem;
}
.idxTwo-title span {
color: #7c7b7b;
display: block;
font-size: .8rem;
position: relative;
line-height: 2rem;
margin-top: .7rem;
}
.idxTwo-title span::after, .idxTwo-title span::before {
position: absolute;
content: '';
}
.idxTwo-title span::after {
left: 15%;
top: .05rem;
width: 70%;
height: .05rem;
background-color: #eeeeee;
}
.idxTwo-title span::before {
left: calc(50% - 2rem);
width: 4rem;
height: .3rem;
top: -.3rem;
background-color: #0069d2;
}
/*
首页第三模块
*/
.ce-none {
display: none;
}
.ce-block {
display: block;
}
.idxThree {
margin: 2rem 0;
}
.idxThree .contant, .idxFour .contant, .idxFooter .contant, .idxOne .contant {
display: flex;
}
.idxThree-left {
width: 800px;
}
.idxThree-right {
width: 400px;
padding-left: 1rem;
box-sizing: border-box;
}
.idxThreeCont {
padding: 2rem;
}
.idxThree-title {
display: flex;
font-size: 1.1rem;
color: #3758a9;
position: relative;
padding-bottom: 1.5rem
}
.idxThree-title img {
margin: .2rem .3rem 0 0;
width: 1rem;
height: 1rem;
}
.idxThree-Ul li {
line-height: 1.7rem;
font-size: 1rem;
color: #706f6f;
padding: 1.5rem 0;
position: relative;
}
.idxThree-Ul li::after, .idxThree-title::after {
position: absolute;
content: '';
left: 0;
bottom: 0;
width: 100%;
height: .05rem;
background-color: #eeeeee;
}
.idxThree-tab {
display: flex;
}
.idxThree-tab li {
flex: 2;
text-align: center;
margin: 0 2rem;
color: #0069d2;
line-height: 4.5rem;
background-color: #fff;
font-size: 1.4rem;
cursor: pointer;
}
.idxThree-tab li.ce-active {
background-color: #0069d2;
color: #fff;
}
.idxThree-tab li img {
width: 1.5rem;
height: 1.5rem;
vertical-align: -.3rem;
margin-right: .5rem
}
.idxThree-tab li.ce-active img {
filter: grayscale(100%) brightness(400%);
}
.idxThree-tips {
color: #d90019;
line-height: 1.6rem;
margin-top: 1rem;
display: flex;
font-weight: 600
}
.idxThree-tips>span {
font-size: 1rem;
display: block;
width: 7rem;
}
.idxThree-img {
margin-bottom: 1rem;
cursor: pointer;
}
.idxThree-img img {
width: 100%;
display: inline-block;
}
/*
首页第四模块
*/
.idxFour{
background-color: #f7f7f7;
width: 100%;
margin-bottom: 2rem;
}
.idxFour-left, .idxFour-right {
background-color: #f3f3f3;
padding: 1rem;
box-sizing: border-box;
border-radius: 1.5rem;
}
.idxFour-left {
width: 500px;
}
.idxFour-right {
width: 700px;
}
.idxFour-cont {
background-color: #fff;
padding: 1rem;
box-sizing: border-box;
}
.idxFour-title {
display: flex;
position: relative;
color: #0069d2;
font-size: 1.1rem;
padding-bottom: .5rem;
margin-bottom: 1rem;
}
.idxFour-title::after {
position: absolute;
content: '';
left: 0;
bottom: 0;
width: 100%;
height: .05rem;
background-color: #92aac0;
}
.idxFour-title img {
width: 1.4rem;
height: 1.4rem;
margin: .1rem .3rem 0 0;
}
.idxFour-text{
color: #5b5b5b;
line-height: 1.8rem;
font-size: .95rem;
margin-bottom: .5rem;
}
.idxFour-text img{
width: 104%;
max-width: none;
margin-top: .5rem;
display: inline-block;
}
.idxFour-right .idxThreeCont {
padding: 0 0 .3rem;
}
.idxFour-right .idxThreeCont li:last-child::after {
display: none
}
.idxFour-right .idxThree-title {
font-size: 1rem;
filter: grayscale(100%) brightness(100%);
}
/*
底部
*/
.idxFooter {
background-color: #252f35;
padding: 2rem;
color: #fff;
}
.idxFooter-left {
width: 300px;
}
.idxFooter-right {
width: 900px;
}
.idxFooter-title {
color: #aaacae
}
.idxFooter-title .idxFooter-name {
font-size: 1.6rem;
color: #fff;
}
.idxFooter-title>span {
background-color: #fff;
width: 6rem;
height: .15rem;
display: block;
margin: .5rem 0;
}
.idxFooter-ul {
margin-top: 1.5rem;
font-size: .9rem;
}
.idxFooter-ul li {
display: flex;
line-height: 2rem;
}
.idxFooter-ul li img {
width: 1.2rem;
height: 1.2rem;
margin: .4rem .5rem 0 0;
}
.idxFooter-right {
margin-left: 2rem;
margin-top: 5.8rem;
position: relative;
}
.idxFooter-right::after{
position: absolute;
content: '';
left: -5rem;
bottom: 0;
width: .05rem;
height: 100%;
background-color: #aaaaaa;
}
.idxFooter-right li {
float: left;
width: 50%;
height: 1.5rem;
line-height: 1.5rem;
}
/*
友情链接
*/
.idxLink {
background-color: #1b262d;
padding: 1rem 0 2rem;
color: #fff;
}
.idxLink-ul {
overflow: hidden;
padding: 0 20px;
box-sizing: border-box;
}
.idxLink-ul li {
float: left;
width: 16.66%;
font-size: 15px;
cursor: pointer;
line-height: 40px;
}
.idxLink-ul li:hover {
color: #06acf9;
}
.line {
background: #fff;
width: 100%;
height: 1px;
margin-top: -15px;
margin-bottom: 10px;
position: relative;
}
.line::before {
position: absolute;
content: '';
left: 0;
bottom: 0;
background-color:#fff;
width: 12%;
height: 2px;
}
.idxTitle {
display: flex;
line-height: 50px;
margin-bottom: 10px;
}
.idxTitle-name {
font-size: 1rem;
flex: 1;
display: flex;
}
.idxTitle-name>span {
font-size: 12px;
padding-left: 6px;
color: #fff;
text-transform : uppercase;
}
.idxTitle img {
width: 1.3rem;
height: 1.3rem;
margin: 1rem .5rem 0 0;
}

15
public/assets/index/css/swiper.min.css vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Some files were not shown because too many files have changed in this diff Show More