first push
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/storage
|
||||
/vendor
|
||||
/.idea
|
||||
/test
|
||||
.env
|
||||
78
README.md
Normal file
@@ -0,0 +1,78 @@
|
||||
<p align="center"><img src="https://res.cloudinary.com/dtfbvvkyp/image/upload/v1566331377/laravel-logolockup-cmyk-red.svg" width="400"></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/d/total.svg" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/v/stable.svg" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a>
|
||||
</p>
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
|
||||
|
||||
- **[Vehikl](https://vehikl.com/)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Cubet Techno Labs](https://cubettech.com)**
|
||||
- **[Cyber-Duck](https://cyber-duck.co.uk)**
|
||||
- **[British Software Development](https://www.britishsoftware.co)**
|
||||
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
|
||||
- **[DevSquad](https://devsquad.com)**
|
||||
- [UserInsights](https://userinsights.com)
|
||||
- [Fragrantica](https://www.fragrantica.com)
|
||||
- [SOFTonSOFA](https://softonsofa.com/)
|
||||
- [User10](https://user10.com)
|
||||
- [Soumettre.fr](https://soumettre.fr/)
|
||||
- [CodeBrisk](https://codebrisk.com)
|
||||
- [1Forge](https://1forge.com)
|
||||
- [TECPRESSO](https://tecpresso.co.jp/)
|
||||
- [Runtime Converter](http://runtimeconverter.com/)
|
||||
- [WebL'Agence](https://weblagence.com/)
|
||||
- [Invoice Ninja](https://www.invoiceninja.com)
|
||||
- [iMi digital](https://www.imi-digital.de/)
|
||||
- [Earthlink](https://www.earthlink.ro/)
|
||||
- [Steadfast Collective](https://steadfastcollective.com/)
|
||||
- [We Are The Robots Inc.](https://watr.mx/)
|
||||
- [Understand.io](https://www.understand.io/)
|
||||
- [Abdel Elrafa](https://abdelelrafa.com)
|
||||
- [Hyper Host](https://hyper.host)
|
||||
- [Appoly](https://www.appoly.co.uk)
|
||||
- [OP.GG](https://op.gg)
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
81
app/Admin/Controllers/Advert/IndexController.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin\Controllers\Advert;
|
||||
|
||||
use App\Models\Advert;
|
||||
use App\Models\Category;
|
||||
use Encore\Admin\Controllers\AdminController;
|
||||
use Encore\Admin\Form;
|
||||
use Encore\Admin\Grid;
|
||||
|
||||
class IndexController extends AdminController
|
||||
{
|
||||
|
||||
protected $title = '广告位管理';
|
||||
|
||||
protected function grid()
|
||||
{
|
||||
$grid = new Grid(new Advert);
|
||||
|
||||
$grid->actions(function ($actions) {
|
||||
$actions->disableView();
|
||||
});
|
||||
|
||||
$grid->filter(function ($filter) {
|
||||
$filter->column(1 / 2, function ($filter) {
|
||||
$filter->like('title', '广告名称');
|
||||
$filter->like('category.id', '分类名称')->select(Category::selectOptions(function ($model) {
|
||||
return $model->where('status', 1)->where('type', Category::TYPE_ADVERT);
|
||||
}, '所有分类'));
|
||||
});
|
||||
$filter->disableIdFilter();
|
||||
});
|
||||
|
||||
$grid->column('id');
|
||||
$grid->column('cover', '图片')->image('', 60, 60);
|
||||
$grid->column('category.title', '分类名称');
|
||||
$grid->column('title', '广告名称');
|
||||
$grid->column('url', '地址');
|
||||
$grid->column('sort', '排序');
|
||||
|
||||
return $grid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a form builder.
|
||||
* @return Form
|
||||
*/
|
||||
protected function form()
|
||||
{
|
||||
$form = new Form(new Advert);
|
||||
|
||||
$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', '封面图片')
|
||||
->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('数字越大越靠前');
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
}
|
||||
65
app/Admin/Controllers/Article/IndexController.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin\Controllers\Article;
|
||||
|
||||
use App\Models\Article;
|
||||
use App\Models\Category;
|
||||
use Encore\Admin\Controllers\AdminController;
|
||||
use Encore\Admin\Form;
|
||||
use Encore\Admin\Grid;
|
||||
|
||||
class IndexController extends AdminController
|
||||
{
|
||||
|
||||
protected $title = '内容管理';
|
||||
|
||||
public function grid()
|
||||
{
|
||||
$grid = new Grid(new Article);
|
||||
$grid->model()->orderBy('id', 'desc');
|
||||
$grid->filter(function ($filter) {
|
||||
$filter->column(1 / 2, function ($filter) {
|
||||
$filter->like('title', '文章标题');
|
||||
$filter->like('category_id', '所属分类')->select(Category::selectOptions(function ($model) {
|
||||
return $model->where('status', 1)->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]);
|
||||
}, '所有分类'));
|
||||
});
|
||||
|
||||
$filter->disableIdFilter();
|
||||
});
|
||||
|
||||
$grid->column('id', '#ID#');
|
||||
$grid->column('cover', '封面图片')->image('', 100);
|
||||
$grid->column('category.title', '所属分类');
|
||||
$grid->column('title', '文章标题');
|
||||
$grid->column('sort', '序号');
|
||||
$grid->column('created_at', '创建时间');
|
||||
|
||||
return $grid;
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
$form = new Form(new Article);
|
||||
|
||||
$form->text('title', '文章标题')->rules('min:2');
|
||||
$form->select('category_id', '所属分类')
|
||||
->options(Category::selectOptions(function ($model) {
|
||||
return $model->where('status', 1)->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]);
|
||||
}, '选择分类'))
|
||||
->rules('required|min:1', [
|
||||
'required' => '必须选择所属分类',
|
||||
'min' => '必须选择所属分类',
|
||||
]);
|
||||
$form->textarea('description', '内容简介');
|
||||
$form->image('cover', '封面')
|
||||
->move('images/' . date('Y/m/d'))
|
||||
->removable()
|
||||
->uniqueName();
|
||||
$form->ueditor('content', '文章内容')->rules('required', ['required' => '详情不能为空']);
|
||||
$form->number('sort', '序号')->default(0)->rules('required', ['required' => '序号必须填写'])->help('倒序优先');
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
}
|
||||
10
app/Admin/Controllers/AuthController.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use Encore\Admin\Controllers\AuthController as BaseAuthController;
|
||||
|
||||
class AuthController extends BaseAuthController
|
||||
{
|
||||
|
||||
}
|
||||
134
app/Admin/Controllers/Category/IndexController.php
Normal file
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin\Controllers\Category;
|
||||
|
||||
use App\Models\Article;
|
||||
use App\Models\Category;
|
||||
use Encore\Admin\Controllers\AdminController;
|
||||
use Encore\Admin\Form;
|
||||
use Encore\Admin\Layout\Column;
|
||||
use Encore\Admin\Layout\Row;
|
||||
use Encore\Admin\Tree;
|
||||
use Encore\Admin\Widgets\Box;
|
||||
use Encore\Admin\Widgets\Form as WidgetsForm;
|
||||
|
||||
class IndexController extends AdminController
|
||||
{
|
||||
|
||||
protected $title = '分类管理';
|
||||
|
||||
/**
|
||||
* Index interface.
|
||||
* @return \Closure
|
||||
*/
|
||||
public function grid()
|
||||
{
|
||||
return function (Row $row) {
|
||||
$row->column(6, $this->treeView());
|
||||
|
||||
$row->column(6, function (Column $column) {
|
||||
$form = new WidgetsForm();
|
||||
|
||||
$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)
|
||||
->required();
|
||||
$form->textarea('description', '分类简介')
|
||||
->rules('nullable');
|
||||
$form->image('cover', 'Logo')
|
||||
->move('images/' . date('Y/m/d'))
|
||||
->removable()
|
||||
->uniqueName();
|
||||
$form->number('order', '排序')->default(0);
|
||||
$form->switch('status', '显示')->states()->default(1);
|
||||
$form->action(admin_url('categories'));
|
||||
|
||||
$column->append((new Box('新增分类', $form))->style('success'));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Tree
|
||||
*/
|
||||
protected function treeView()
|
||||
{
|
||||
return Category::tree(function (Tree $tree) {
|
||||
$tree->disableCreate();
|
||||
|
||||
$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;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a form builder.
|
||||
* @return Form
|
||||
*/
|
||||
protected function form()
|
||||
{
|
||||
$form = new Form(new Category);
|
||||
|
||||
$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)
|
||||
->required()
|
||||
->rules('required');
|
||||
$form->textarea('description', '分类简介')->rows(4)->rules('nullable');
|
||||
$form->image('cover', 'Logo')
|
||||
->move('images/' . date('Y/m/d'))
|
||||
->removable()
|
||||
->uniqueName();
|
||||
$form->number('order', '排序')->default(0);
|
||||
$form->select('article_id', '关联文章')
|
||||
->options(function ($option, $info) {
|
||||
$category = $this;
|
||||
if ($category) {
|
||||
return Article::where('category_id', $category->id)->pluck('title', 'id');
|
||||
} else {
|
||||
return [0 => '没有数据'];
|
||||
}
|
||||
})->help('当分类类型是文章详情的时候需要选择关联文章');
|
||||
|
||||
$form->switch('status', '显示')->states()->default(1);
|
||||
$form->saving(function (Form $form) {
|
||||
|
||||
if (request()->has('title')) {
|
||||
if (request()->type == Category::TYPE_SHOW && empty(request()->article_id)) {
|
||||
$error = new MessageBag([
|
||||
'title' => '错误',
|
||||
'message' => '文章类型是文章详情的时候需要选择关联文章',
|
||||
]);
|
||||
|
||||
return back()->withInput()->with(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return $this->form()->destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
67
app/Admin/Controllers/ExampleController.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use Encore\Admin\Controllers\AdminController;
|
||||
use Encore\Admin\Form;
|
||||
use Encore\Admin\Grid;
|
||||
use Encore\Admin\Show;
|
||||
|
||||
class ExampleController extends AdminController
|
||||
{
|
||||
/**
|
||||
* Title for current resource.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $title = 'Example controller';
|
||||
|
||||
/**
|
||||
* Make a grid builder.
|
||||
*
|
||||
* @return Grid
|
||||
*/
|
||||
protected function grid()
|
||||
{
|
||||
$grid = new Grid(new ExampleModel);
|
||||
|
||||
$grid->column('id', __('ID'))->sortable();
|
||||
$grid->column('created_at', __('Created at'));
|
||||
$grid->column('updated_at', __('Updated at'));
|
||||
|
||||
return $grid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a show builder.
|
||||
*
|
||||
* @param mixed $id
|
||||
* @return Show
|
||||
*/
|
||||
protected function detail($id)
|
||||
{
|
||||
$show = new Show(ExampleModel::findOrFail($id));
|
||||
|
||||
$show->field('id', __('ID'));
|
||||
$show->field('created_at', __('Created at'));
|
||||
$show->field('updated_at', __('Updated at'));
|
||||
|
||||
return $show;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a form builder.
|
||||
*
|
||||
* @return Form
|
||||
*/
|
||||
protected function form()
|
||||
{
|
||||
$form = new Form(new ExampleModel);
|
||||
|
||||
$form->display('id', __('ID'));
|
||||
$form->display('created_at', __('Created At'));
|
||||
$form->display('updated_at', __('Updated At'));
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
34
app/Admin/Controllers/HomeController.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Encore\Admin\Controllers\Dashboard;
|
||||
use Encore\Admin\Layout\Column;
|
||||
use Encore\Admin\Layout\Content;
|
||||
use Encore\Admin\Layout\Row;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function index(Content $content)
|
||||
{
|
||||
return $content
|
||||
->title('Dashboard')
|
||||
->description('Description...')
|
||||
->row(Dashboard::title())
|
||||
->row(function (Row $row) {
|
||||
|
||||
$row->column(4, function (Column $column) {
|
||||
$column->append(Dashboard::environment());
|
||||
});
|
||||
|
||||
$row->column(4, function (Column $column) {
|
||||
$column->append(Dashboard::extensions());
|
||||
});
|
||||
|
||||
$row->column(4, function (Column $column) {
|
||||
$column->append(Dashboard::dependencies());
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
37
app/Admin/Controllers/Link/IndexController.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin\Controllers\Link;
|
||||
|
||||
use App\Models\Link;
|
||||
use Encore\Admin\Controllers\AdminController;
|
||||
use Encore\Admin\Form;
|
||||
use Encore\Admin\Grid;
|
||||
|
||||
class IndexController extends AdminController
|
||||
{
|
||||
|
||||
protected $title = '友情链接';
|
||||
|
||||
public function grid()
|
||||
{
|
||||
$grid = new Grid(new Link);
|
||||
|
||||
$grid->column('id', '#ID#');
|
||||
$grid->column('title', '标题');
|
||||
$grid->column('url', '地址');
|
||||
$grid->column('created_at', '创建时间');
|
||||
|
||||
return $grid;
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
$form = new Form(new Link);
|
||||
|
||||
$form->text('title', '标题')->required();
|
||||
$form->text('url', '地址')->required();
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
}
|
||||
12
app/Admin/Routes/advert.php
Normal 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');
|
||||
|
||||
});
|
||||
12
app/Admin/Routes/article.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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');
|
||||
|
||||
});
|
||||
12
app/Admin/Routes/category.php
Normal 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/link.php
Normal 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');
|
||||
|
||||
});
|
||||
29
app/Admin/bootstrap.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Encore\Admin\Form;
|
||||
use Encore\Admin\Grid;
|
||||
|
||||
Form::forget(['map', 'editor']);
|
||||
|
||||
Form::init(function (Form $form) {
|
||||
$form->disableEditingCheck();
|
||||
$form->disableCreatingCheck();
|
||||
$form->disableViewCheck();
|
||||
$form->tools(function (Form\Tools $tools) {
|
||||
$tools->disableDelete();
|
||||
$tools->disableView();
|
||||
$tools->disableList();
|
||||
});
|
||||
});
|
||||
|
||||
Grid::init(function (Grid $grid) {
|
||||
$grid->disableExport();
|
||||
$grid->actions(function (Grid\Displayers\Actions $actions) {
|
||||
$actions->disableView();
|
||||
});
|
||||
$grid->disableBatchActions();
|
||||
$grid->filter(function ($filter) {
|
||||
$filter->disableIdFilter();
|
||||
});
|
||||
// $grid->expandFilter();
|
||||
});
|
||||
21
app/Admin/routes.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Routing\Router;
|
||||
|
||||
Admin::routes();
|
||||
|
||||
Route::group([
|
||||
'prefix' => config('admin.route.prefix'),
|
||||
'namespace' => config('admin.route.namespace'),
|
||||
'middleware' => config('admin.route.middleware'),
|
||||
'as' => config('admin.route.prefix') . '.',
|
||||
], function (Router $router) {
|
||||
|
||||
$router->get('/', 'HomeController@index')->name('home');
|
||||
|
||||
});
|
||||
|
||||
require __DIR__ . '/Routes/article.php';
|
||||
require __DIR__ . '/Routes/category.php';
|
||||
require __DIR__ . '/Routes/link.php';
|
||||
require __DIR__ . '/Routes/advert.php';
|
||||
42
app/Console/Kernel.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
57
app/Exceptions/Handler.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
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',
|
||||
];
|
||||
|
||||
/**
|
||||
* Report or log an exception.
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @return void
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function report(Throwable $exception)
|
||||
{
|
||||
parent::report($exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $exception
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function render($request, Throwable $exception)
|
||||
{
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
}
|
||||
28
app/Http/Controllers/ArticleController.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Advert;
|
||||
use App\Models\Article;
|
||||
|
||||
class ArticleController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 显示分类
|
||||
* @param Category $category [description]
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function show(Article $article)
|
||||
{
|
||||
$parent = $category = $article->category;
|
||||
if ($category->childrens->isEmpty()) {
|
||||
$parent = $category->parent;
|
||||
}
|
||||
$advert = Advert::where('category_id',73)->first();
|
||||
|
||||
return view('article.show', compact('article', 'parent', 'category','advert'));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
40
app/Http/Controllers/Auth/ConfirmPasswordController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ConfirmsPasswords;
|
||||
|
||||
class ConfirmPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Confirm Password Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password confirmations and
|
||||
| uses a simple trait to include the behavior. You're free to explore
|
||||
| this trait and override any functions that require customization.
|
||||
|
|
||||
*/
|
||||
|
||||
use ConfirmsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users when the intended url fails.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
}
|
||||
22
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset emails and
|
||||
| includes a trait which assists in sending these notifications from
|
||||
| your application to your users. Feel free to explore this trait.
|
||||
|
|
||||
*/
|
||||
|
||||
use SendsPasswordResetEmails;
|
||||
}
|
||||
40
app/Http/Controllers/Auth/LoginController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles authenticating users for the application and
|
||||
| redirecting them to your home screen. The controller uses a trait
|
||||
| to conveniently provide its functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
}
|
||||
73
app/Http/Controllers/Auth/RegisterController.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use App\User;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles the registration of new users as well as their
|
||||
| validation and creation. By default this controller uses a trait to
|
||||
| provide this functionality without requiring any additional code.
|
||||
|
|
||||
*/
|
||||
|
||||
use RegistersUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after registration.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a validator for an incoming registration request.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function validator(array $data)
|
||||
{
|
||||
return Validator::make($data, [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \App\User
|
||||
*/
|
||||
protected function create(array $data)
|
||||
{
|
||||
return User::create([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => Hash::make($data['password']),
|
||||
]);
|
||||
}
|
||||
}
|
||||
30
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset requests
|
||||
| and uses a simple trait to include this behavior. You're free to
|
||||
| explore this trait and override any methods you wish to tweak.
|
||||
|
|
||||
*/
|
||||
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users after resetting their password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
}
|
||||
42
app/Http/Controllers/Auth/VerificationController.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\VerifiesEmails;
|
||||
|
||||
class VerificationController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Email Verification Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling email verification for any
|
||||
| user that recently registered with the application. Emails may also
|
||||
| be re-sent if the user didn't receive the original email message.
|
||||
|
|
||||
*/
|
||||
|
||||
use VerifiesEmails;
|
||||
|
||||
/**
|
||||
* Where to redirect users after verification.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('signed')->only('verify');
|
||||
$this->middleware('throttle:6,1')->only('verify', 'resend');
|
||||
}
|
||||
}
|
||||
33
app/Http/Controllers/CategoryController.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Advert;
|
||||
use App\Models\Category;
|
||||
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 显示分类
|
||||
* @param Category $category [description]
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function index(Category $category)
|
||||
{
|
||||
if ($category->type == Category::TYPE_SHOW && $category->article_id) {
|
||||
return redirect("articles/" . $category->article_id);
|
||||
} else {
|
||||
$articles = $category->relations(Category::TYPE_ARTICLE)->paginate();
|
||||
$parent = $category;
|
||||
if ($category->childrens->isEmpty()) {
|
||||
$parent = $category->parent;
|
||||
}
|
||||
|
||||
$advert = Advert::where('category_id',73)->first();
|
||||
|
||||
return view('category.show', compact('articles', 'category', 'parent','advert'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
37
app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Advert;
|
||||
use App\Models\Category;
|
||||
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('status', 1)
|
||||
->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW])
|
||||
->where('top_show', 1)
|
||||
->orderBy('order', 'desc')
|
||||
->select('id', 'title')
|
||||
->get();
|
||||
|
||||
//地步友情链接
|
||||
if (url()->current() == route('index.index')) {
|
||||
$adverts = Advert::where('category_id', 26)->get();
|
||||
View::share('adverts', $adverts);
|
||||
|
||||
}
|
||||
View::share('all_categorys', $categorys);
|
||||
}
|
||||
|
||||
}
|
||||
40
app/Http/Controllers/IndexController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Article;
|
||||
use App\Models\Link;
|
||||
|
||||
class IndexController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Notes: 首页
|
||||
* @Author: 玄尘
|
||||
* @Date : 2020/6/1 9:11
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$fydt = $this->getArticle([6], 9); //分院动态
|
||||
$kydt = $this->getArticle([9], 9); //科研动态
|
||||
$ldbz = $this->getArticle([3], 4); //领导班子
|
||||
$kycg = $this->getArticle([10], 8); //科研成果
|
||||
$rctd = $this->getArticle([4], 9); //人才团队介绍
|
||||
$info = Article::where('category_id', 2)->first(); //院所介绍
|
||||
$links = Link::get();
|
||||
|
||||
return view('index.index', compact('links', 'fydt', 'kydt', 'ldbz', 'kycg', 'rctd', 'info'));
|
||||
}
|
||||
|
||||
//通用获取文章
|
||||
public function getArticle($category_ids, $take = 3)
|
||||
{
|
||||
return Article::whereIn('category_id', $category_ids)
|
||||
->select('id', 'description', 'title', 'created_at', 'cover', 'content')
|
||||
->latest('sort')
|
||||
->latest()
|
||||
->take($take)
|
||||
->get();
|
||||
}
|
||||
|
||||
}
|
||||
197
app/Http/Controllers/TestController.php
Normal file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Article;
|
||||
use App\Models\Category;
|
||||
use App\Models\DedeArchive;
|
||||
use App\Models\DedeArctype;
|
||||
use App\Traits\Tree;
|
||||
|
||||
class TestController extends Controller
|
||||
{
|
||||
use Tree;
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//检查分类
|
||||
public function checkCategory()
|
||||
{
|
||||
|
||||
// $lists = Category::where('created_at','2020-06-03 15:57:55')->get();
|
||||
// $i=1;
|
||||
// foreach ($lists as $info){
|
||||
// $old = DedeArctype::select('id', 'reid as parent_id', 'typename as title', 'content')->find($info->oldid);
|
||||
// $cate = Category::where('oldid',$old->parent_id)->first();
|
||||
// $info->parent_id = $cate->id;
|
||||
// $info->save();
|
||||
// $i++;
|
||||
// }
|
||||
|
||||
// dd($i);
|
||||
// dump(count($lists));
|
||||
// dd();
|
||||
$cateids = Category::where('oldid', '>', 0)->pluck('oldid');
|
||||
$oldids = DedeArctype::where('ishidden', 0)->pluck('id');
|
||||
$diffids = array_diff($oldids->toArray(), $cateids->toArray());
|
||||
dump(count($cateids));
|
||||
dump(count($oldids));
|
||||
dump($diffids);
|
||||
|
||||
foreach ($diffids as $diffid) {
|
||||
$info = DedeArctype::where('id', $diffid)->where('ishidden', 0)->select('id', 'reid as parent_id', 'typename as title', 'content')->first();
|
||||
$data = $this->getData($info);
|
||||
Category::create($data);
|
||||
}
|
||||
}
|
||||
|
||||
public function setCateArticle()
|
||||
{
|
||||
$article = [];
|
||||
$lists = Category::where('content', '<>', '')->where('type', 'article')->get();
|
||||
if ($lists->isEmpty()) {
|
||||
dd('没有数据');
|
||||
}
|
||||
foreach ($lists as $key => $cate) {
|
||||
if ($cate->content != ' ') {
|
||||
$data = [
|
||||
'oldid' => 0,
|
||||
'title' => $cate->title,
|
||||
'category_id' => $cate->id,
|
||||
'writer' => 'admin',
|
||||
'source' => '未知',
|
||||
'keywords' => '',
|
||||
'status' => 1,
|
||||
'description' => $cate->description,
|
||||
'content' => $cate->content,
|
||||
'created_at' => $cate->created_at,
|
||||
];
|
||||
|
||||
$info = Article::create($data);
|
||||
$cate->article_id = $info->id;
|
||||
$cate->type = Category::TYPE_SHOW;
|
||||
$cate->save();
|
||||
$article[] = $info->id;
|
||||
}
|
||||
|
||||
}
|
||||
dump(count($article));
|
||||
}
|
||||
|
||||
public function checkArticle()
|
||||
{
|
||||
// $lists = Article::where('category_id', 0)->get();
|
||||
// foreach ($lists as $list) {
|
||||
// $old = DedeArchive::find($list->oldid);
|
||||
// $cate = Category::where('oldid', $old->typeid)->first();
|
||||
// $list->category_id = $cate->id;
|
||||
// $list->save();
|
||||
// }
|
||||
// dd();
|
||||
$articleids = Article::where('oldid', '>', 0)->pluck('oldid');
|
||||
$oldids = DedeArchive::pluck('id');
|
||||
$diffids = array_diff($oldids->toArray(), $articleids->toArray());
|
||||
dump(count($articleids));
|
||||
dump(count($oldids));
|
||||
dump($diffids);
|
||||
die();
|
||||
$map = [
|
||||
'id' => ['in', $diffids],
|
||||
];
|
||||
$list = DedeArchive::whereIn('id', $diffids)->get();
|
||||
foreach ($list as $key => $article) {
|
||||
$data = [
|
||||
'oldid' => $article->id,
|
||||
'title' => $article->title,
|
||||
'category_id' => $category->id ?? '0',
|
||||
'writer' => $article->writer,
|
||||
'cover' => $article->litpic,
|
||||
'source' => $article->source,
|
||||
'keywords' => $article->keywords,
|
||||
'description' => $article->description,
|
||||
'status' => 1,
|
||||
'content' => $article->info->body ?? '',
|
||||
'created_at' => date('Y-m-d H:i:s', $article->pubdate),
|
||||
];
|
||||
Article::create($data);
|
||||
}
|
||||
}
|
||||
|
||||
//导入文章
|
||||
public function set_article()
|
||||
{
|
||||
$articles = Article::get();
|
||||
if ($articles->count() > 4) {
|
||||
dd('已经导入过数据');
|
||||
}
|
||||
$categorys = Category::get();
|
||||
$error = $success = [];
|
||||
DedeArchive::whereNotNull('litpic')->chunk(200, function ($articles) use ($categorys) {
|
||||
|
||||
foreach ($articles as $article) {
|
||||
|
||||
$category = $categorys->where('oldid', $article->typeid)->first();
|
||||
$data = [
|
||||
'oldid' => $article->id,
|
||||
'title' => $article->title,
|
||||
'category_id' => $category->id ?? '0',
|
||||
'writer' => $article->writer,
|
||||
'source' => $article->source,
|
||||
'cover' => $article->litpic,
|
||||
'keywords' => $article->keywords,
|
||||
'description' => $article->description,
|
||||
'status' => 1,
|
||||
'content' => $article->info->body ?? '',
|
||||
'created_at' => date('Y-m-d H:i:s', $article->pubdate),
|
||||
];
|
||||
|
||||
$res = Article::create($data);
|
||||
if (!$res) {
|
||||
$error[] = $article->id;
|
||||
} else {
|
||||
$success[] = $article->id;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
dump($error);
|
||||
dump($success);
|
||||
}
|
||||
|
||||
//导入分类
|
||||
public function set_category()
|
||||
{
|
||||
$categorys = Category::get();
|
||||
if ($categorys->count() > 1) {
|
||||
dd('已经导入过数据');
|
||||
}
|
||||
$lists = DedeArctype::where('ishidden', 0)->select('id', 'reid as parent_id', 'typename as title', 'content')->get();
|
||||
$list = Tree::list2tree($lists->toArray(), 'id', 'parent_id', 'children', 0);
|
||||
|
||||
foreach ($list as $key => $value) {
|
||||
$info = Category::create($this->getData($value));
|
||||
if (isset($value['children']) && count($value['children']) > 0) {
|
||||
foreach ($value['children'] as $key => $children) {
|
||||
$info->children()->create($this->getData($children));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//格式化分类数据
|
||||
public function getData($category)
|
||||
{
|
||||
$data = [
|
||||
'oldid' => $category['id'],
|
||||
'parent_id' => $category['parent_id'],
|
||||
'title' => $category['title'],
|
||||
'content' => $category['content'],
|
||||
'status' => 1,
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
82
app/Http/Kernel.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?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\TrustProxies::class,
|
||||
\App\Http\Middleware\CheckForMaintenanceMode::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:60,1',
|
||||
\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,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::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,
|
||||
];
|
||||
|
||||
/**
|
||||
* The priority-sorted list of middleware.
|
||||
*
|
||||
* This forces non-global middleware to always be in the given order.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $middlewarePriority = [
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\Authenticate::class,
|
||||
\Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
\Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
\Illuminate\Auth\Middleware\Authorize::class,
|
||||
];
|
||||
}
|
||||
21
app/Http/Middleware/Authenticate.php
Normal 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');
|
||||
}
|
||||
}
|
||||
}
|
||||
17
app/Http/Middleware/CheckForMaintenanceMode.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;
|
||||
|
||||
class CheckForMaintenanceMode extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
17
app/Http/Middleware/EncryptCookies.php
Normal 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 = [
|
||||
//
|
||||
];
|
||||
}
|
||||
27
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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 $guard
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
{
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
18
app/Http/Middleware/TrimStrings.php
Normal 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',
|
||||
];
|
||||
}
|
||||
23
app/Http/Middleware/TrustProxies.php
Normal 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
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers = Request::HEADER_X_FORWARDED_ALL;
|
||||
}
|
||||
24
app/Http/Middleware/VerifyCsrfToken.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $addHttpCookie = true;
|
||||
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
15
app/Models/Advert.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Traits\BelongsToCategory;
|
||||
use App\Models\Traits\HasOneCover;
|
||||
use App\Models\Traits\OrderByIdDesc;
|
||||
use App\Scopes\SortScope;
|
||||
|
||||
class Advert extends Model
|
||||
{
|
||||
|
||||
use HasOneCover,
|
||||
BelongsToCategory;
|
||||
}
|
||||
46
app/Models/Article.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Traits\BelongsToCategory;
|
||||
use App\Models\Traits\HasOneCover;
|
||||
|
||||
class Article extends Model
|
||||
{
|
||||
use HasOneCover, BelongsToCategory;
|
||||
|
||||
public function get_content_cover()
|
||||
{
|
||||
preg_match("/<img.*?src=\"([^\"]+)\"[^>].*?>/isU", str_ireplace("\\", "", $this->content), $matches);
|
||||
|
||||
if (isset($matches[1])) {
|
||||
return $matches[1];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 获取一个默认图片
|
||||
* @Author: 玄尘
|
||||
* @Date : 2020/6/3 16:29
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function get_one_cover()
|
||||
{
|
||||
if ($this->cover_path) {
|
||||
$path = $this->cover_path;
|
||||
} else {
|
||||
$path = $this->get_content_cover();
|
||||
// if ($path) {
|
||||
// $this->cover = str_replace("/storage", "", $path);
|
||||
// $this->save();
|
||||
// }
|
||||
$path = config('app.url') . $path;
|
||||
|
||||
}
|
||||
return $path;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
72
app/Models/Category.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Encore\Admin\Traits\AdminBuilder;
|
||||
use Encore\Admin\Traits\ModelTree;
|
||||
|
||||
class Category extends Model
|
||||
{
|
||||
use AdminBuilder, ModelTree;
|
||||
|
||||
public const TYPES = [
|
||||
'article' => '文章列表',
|
||||
'show' => '文章详情',
|
||||
'advert' => '广告',
|
||||
];
|
||||
|
||||
public const TYPE_SHOW = 'show';
|
||||
public const TYPE_ARTICLE = 'article';
|
||||
public const TYPE_ADVERT = 'advert';
|
||||
|
||||
/**
|
||||
* 关联的数据
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function relations()
|
||||
{
|
||||
switch ($this->type) {
|
||||
case self::TYPE_SHOW:
|
||||
return $this->belongsTo(Article::class);
|
||||
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 childrens()
|
||||
{
|
||||
return $this->hasMany(self::class,'parent_id');
|
||||
}
|
||||
|
||||
public function parent()
|
||||
{
|
||||
return $this->hasOne(self::class,'id','parent_id');
|
||||
}
|
||||
|
||||
public function article()
|
||||
{
|
||||
return $this->belongsTo(Article::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 获取当前分类及子分类ID
|
||||
* @Author: <C.Jason>
|
||||
* @Date : 2020/4/6 3:12 下午
|
||||
* @return array
|
||||
*/
|
||||
public function getAllChildrenId()
|
||||
{
|
||||
$ids = array_keys($this->buildSelectOptions([], $this->id));
|
||||
array_unshift($ids, $this->id);
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
||||
7
app/Models/DedeAddonarticle.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class DedeAddonarticle extends Model
|
||||
{
|
||||
}
|
||||
11
app/Models/DedeArchive.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class DedeArchive extends Model
|
||||
{
|
||||
public function info()
|
||||
{
|
||||
return $this->hasOne(DedeAddonarticle::class, 'aid');
|
||||
}
|
||||
}
|
||||
11
app/Models/DedeArctype.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Encore\Admin\Traits\AdminBuilder;
|
||||
use Encore\Admin\Traits\ModelTree;
|
||||
|
||||
class DedeArctype extends Model
|
||||
{
|
||||
use AdminBuilder, ModelTree;
|
||||
}
|
||||
8
app/Models/Link.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class Link extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
22
app/Models/Model.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
|
||||
class Model extends Eloquent
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* 为数组 / JSON 序列化准备日期。
|
||||
*
|
||||
* @param \DateTimeInterface $date
|
||||
* @return string
|
||||
*/
|
||||
protected function serializeDate(DateTimeInterface $date)
|
||||
{
|
||||
return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
}
|
||||
21
app/Models/Traits/BelongsToCategory.php
Normal 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();
|
||||
}
|
||||
|
||||
}
|
||||
24
app/Models/Traits/HasOneCover.php
Normal 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 '';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
34
app/Providers/AppServiceProvider.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Encore\Admin\Config\Config;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
//add fixed sql
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
Schema::defaultStringLength(191); //add fixed sql
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$table = config('admin.extensions.config.table', 'admin_config');
|
||||
if (Schema::hasTable($table)) {
|
||||
Config::load();
|
||||
}
|
||||
}
|
||||
}
|
||||
30
app/Providers/AuthServiceProvider.php
Normal 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();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
21
app/Providers/BroadcastServiceProvider.php
Normal 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');
|
||||
}
|
||||
}
|
||||
34
app/Providers/EventServiceProvider.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
80
app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* This namespace is applied to your controller routes.
|
||||
*
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'App\Http\Controllers';
|
||||
|
||||
/**
|
||||
* The path to the "home" route for your application.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/home';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
}
|
||||
}
|
||||
90
app/Traits/Tree.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
// +------------------------------------------------+
|
||||
// | http://www.cjango.com |
|
||||
// +------------------------------------------------+
|
||||
// | 修复BUG不是一朝一夕的事情,等我喝醉了再说吧! |
|
||||
// +------------------------------------------------+
|
||||
// | Author: 小陈叔叔 <Jason.Chen> |
|
||||
// +------------------------------------------------+
|
||||
namespace App\Traits;
|
||||
|
||||
/**
|
||||
* 生成多层树状下拉选框的工具
|
||||
*/
|
||||
trait Tree
|
||||
{
|
||||
|
||||
/**
|
||||
* 用于树型数组完成递归格式的全局变量
|
||||
*/
|
||||
private static $formatTree;
|
||||
|
||||
/**
|
||||
* 生成多层树,供下拉选框使用
|
||||
*/
|
||||
public static function toFormatTree($list, $title = 'title', $pk = 'id', $pid = 'pid', $root = 0)
|
||||
{
|
||||
$list = self::list2tree($list, $pk, $pid, '_child', $root);
|
||||
|
||||
self::$formatTree = [];
|
||||
self::_toFormatTree($list, 0, $title);
|
||||
return self::$formatTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 把数据集转换成Tree
|
||||
* @param array $list 要转换的数据集
|
||||
* @param string $pk [description]
|
||||
* @param string $pid [description]
|
||||
* @param string $child [description]
|
||||
* @param integer $root [description]
|
||||
* @return array
|
||||
*/
|
||||
public static function list2tree($list, $pk = 'id', $pid = 'pid', $child = 'children', $root = 0)
|
||||
{
|
||||
$tree = [];
|
||||
if (is_array($list)) {
|
||||
$refer = [];
|
||||
foreach ($list as $key => $data) {
|
||||
$refer[$data[$pk]] = &$list[$key];
|
||||
}
|
||||
foreach ($list as $key => $data) {
|
||||
$parentId = $data[$pid];
|
||||
if ($root == $parentId) {
|
||||
$tree[] = &$list[$key];
|
||||
} else {
|
||||
if (isset($refer[$parentId])) {
|
||||
$parent = &$refer[$parentId];
|
||||
$parent[$child][] = &$list[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将格式数组转换为树
|
||||
* @param array $list
|
||||
* @param integer $level 进行递归时传递用的参数
|
||||
* @author 小陈叔叔 <Jason.Chen[cjango.com]>
|
||||
*/
|
||||
private static function _toFormatTree($list, $level = 0, $title = 'title')
|
||||
{
|
||||
foreach ($list as $key => $val) {
|
||||
$tmp_str = str_repeat(" ", $level * 4);
|
||||
$tmp_str .= "└ ";
|
||||
$val['level'] = $level;
|
||||
$val['title_show'] = $level == 0 ? $val[$title] . " " : $tmp_str . $val[$title];
|
||||
if (!array_key_exists('_child', $val)) {
|
||||
array_push(self::$formatTree, $val);
|
||||
} else {
|
||||
$tmp_ary = $val['_child'];
|
||||
unset($val['_child']);
|
||||
array_push(self::$formatTree, $val);
|
||||
self::_toFormatTree($tmp_ary, $level + 1, $title); //进行下一层递归
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
39
app/User.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email', 'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password', 'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
53
artisan
Normal 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
@@ -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
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
64
composer.json
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The Laravel Framework.",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel"
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.2",
|
||||
"codingyu/ueditor": "^3.0",
|
||||
"encore/laravel-admin": "^1.8",
|
||||
"fideloper/proxy": "^4.0",
|
||||
"laravel-admin-ext/config": "^1.1",
|
||||
"laravel/framework": "^7.0",
|
||||
"laravel/tinker": "^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"facade/ignition": "^2.0",
|
||||
"fzaninotto/faker": "^1.9.1",
|
||||
"mockery/mockery": "^1.0",
|
||||
"nunomaduro/collision": "^4.1",
|
||||
"phpunit/phpunit": "^8.5"
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
},
|
||||
"classmap": [
|
||||
"database/seeds",
|
||||
"database/factories"
|
||||
]
|
||||
},
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
6627
composer.lock
generated
Normal file
409
config/admin.php
Normal file
@@ -0,0 +1,409 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laravel-admin name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of laravel-admin, This setting is displayed on the
|
||||
| login page.
|
||||
|
|
||||
*/
|
||||
'name' => '大庆分院',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laravel-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' => '<b>大庆</b>分院',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laravel-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' => '<b>dqb</b>',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laravel-admin bootstrap setting
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the path of laravel-admin bootstrap file.
|
||||
|
|
||||
*/
|
||||
'bootstrap' => app_path('Admin/bootstrap.php'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laravel-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'],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laravel-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'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laravel-admin html title
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Html title for all pages.
|
||||
|
|
||||
*/
|
||||
'title' => '管理平台',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Access via `https`
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If your page is going to be accessed via https, set it to `true`.
|
||||
|
|
||||
*/
|
||||
'https' => env('ADMIN_HTTPS', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laravel-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' => [
|
||||
|
||||
'controller' => App\Admin\Controllers\AuthController::class,
|
||||
|
||||
'guard' => 'admin',
|
||||
|
||||
'guards' => [
|
||||
'admin' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'admin',
|
||||
],
|
||||
],
|
||||
|
||||
'providers' => [
|
||||
'admin' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => Encore\Admin\Auth\Database\Administrator::class,
|
||||
],
|
||||
],
|
||||
|
||||
// Add "remember me" to login form
|
||||
'remember' => true,
|
||||
|
||||
// Redirect to the specified URI when user is not authorized.
|
||||
'redirect_to' => 'auth/login',
|
||||
|
||||
// The URIs that should be excluded from authorization.
|
||||
'excepts' => [
|
||||
'auth/login',
|
||||
'auth/logout',
|
||||
'_handle_action_',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laravel-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',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laravel-admin database settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here are database settings for laravel-admin builtin model & tables.
|
||||
|
|
||||
*/
|
||||
'database' => [
|
||||
|
||||
// Database connection for following tables.
|
||||
'connection' => '',
|
||||
|
||||
// User tables and model.
|
||||
'users_table' => 'admin_users',
|
||||
'users_model' => Encore\Admin\Auth\Database\Administrator::class,
|
||||
|
||||
// Role table and model.
|
||||
'roles_table' => 'admin_roles',
|
||||
'roles_model' => Encore\Admin\Auth\Database\Role::class,
|
||||
|
||||
// Permission table and model.
|
||||
'permissions_table' => 'admin_permissions',
|
||||
'permissions_model' => Encore\Admin\Auth\Database\Permission::class,
|
||||
|
||||
// Menu table and model.
|
||||
'menu_table' => 'admin_menu',
|
||||
'menu_model' => Encore\Admin\Auth\Database\Menu::class,
|
||||
|
||||
// Pivot table for table above.
|
||||
'operation_log_table' => 'admin_operation_log',
|
||||
'user_permissions_table' => 'admin_user_permissions',
|
||||
'role_users_table' => 'admin_role_users',
|
||||
'role_permissions_table' => 'admin_role_permissions',
|
||||
'role_menu_table' => 'admin_role_menu',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User operation log setting
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to open or close operation log in laravel-admin.
|
||||
|
|
||||
*/
|
||||
'operation_log' => [
|
||||
|
||||
'enable' => true,
|
||||
|
||||
/*
|
||||
* Only logging allowed methods in the list
|
||||
*/
|
||||
'allowed_methods' => ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'],
|
||||
|
||||
/*
|
||||
* Routes that will not log to database.
|
||||
*
|
||||
* All method to path like: admin/auth/logs
|
||||
* or specific method to path like: get:admin/auth/logs.
|
||||
*/
|
||||
'except' => [
|
||||
'admin/auth/logs*',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Indicates whether to check route permission.
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'check_route_permission' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Indicates whether to check menu roles.
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'check_menu_roles' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User default avatar
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set a default avatar for newly created users.
|
||||
|
|
||||
*/
|
||||
'default_avatar' => '/vendor/laravel-admin/AdminLTE/dist/img/user2-160x160.jpg',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Admin map field provider
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Supported: "tencent", "google", "yandex".
|
||||
|
|
||||
*/
|
||||
'map_provider' => 'google',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Skin
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the skin of admin pages.
|
||||
| @see https://adminlte.io/docs/2.4/layout
|
||||
|
|
||||
| Supported:
|
||||
| "skin-blue", "skin-blue-light", "skin-yellow", "skin-yellow-light",
|
||||
| "skin-green", "skin-green-light", "skin-purple", "skin-purple-light",
|
||||
| "skin-red", "skin-red-light", "skin-black", "skin-black-light".
|
||||
|
|
||||
*/
|
||||
'skin' => 'skin-blue-light',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application layout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the layout of admin pages.
|
||||
| @see https://adminlte.io/docs/2.4/layout
|
||||
|
|
||||
| Supported: "fixed", "layout-boxed", "layout-top-nav", "sidebar-collapse",
|
||||
| "sidebar-mini".
|
||||
|
|
||||
*/
|
||||
'layout' => ['fixed', 'sidebar-mini'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login page background image
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is used to set the background image of login page.
|
||||
|
|
||||
*/
|
||||
'login_background_image' => '',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Show version at footer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Whether to display the version number of laravel-admin at the footer of
|
||||
| each page
|
||||
|
|
||||
*/
|
||||
'show_version' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Show environment at footer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Whether to display the environment at the footer of each page
|
||||
|
|
||||
*/
|
||||
'show_environment' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Menu bind to permission
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| whether enable menu bind to a permission
|
||||
*/
|
||||
'menu_bind_permission' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable default breadcrumb
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Whether enable default breadcrumb for every page content.
|
||||
*/
|
||||
'enable_default_breadcrumb' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable/Disable assets minify
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'minify_assets' => [
|
||||
|
||||
// Assets will not be minified.
|
||||
'excepts' => [
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable/Disable sidebar menu search
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'enable_menu_search' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Alert message that will displayed on top of the page.
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'top_alert' => '',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| The global Grid action display class.
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'grid_action_class' => \Encore\Admin\Grid\Displayers\DropdownActions::class,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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/laravel-admin-extensions.
|
||||
|
|
||||
*/
|
||||
'extensions' => [
|
||||
'ueditor' => [
|
||||
// 如果要关掉这个扩展,设置为false
|
||||
'enable' => true,
|
||||
// 编辑器的前端配置 参考:http://fex.baidu.com/ueditor/#start-config
|
||||
'config' => [
|
||||
'initialFrameHeight' => 400, // 例如初始化高度
|
||||
],
|
||||
'field_type' => 'ueditor',
|
||||
],
|
||||
],
|
||||
];
|
||||
231
config/app.php
Normal file
@@ -0,0 +1,231 @@
|
||||
<?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,
|
||||
'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
@@ -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\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
@@ -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',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
103
config/cache.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?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',
|
||||
],
|
||||
|
||||
'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'),
|
||||
|
||||
];
|
||||
147
config/database.php
Normal 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'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
77
config/filesystems.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?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'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
52
config/hashing.php
Normal 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
@@ -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'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
136
config/mail.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mail Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
|
||||
| sending of e-mail. You may specify which one you're using throughout
|
||||
| your application here. By default, Laravel is setup for SMTP mail.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses",
|
||||
| "postmark", "log", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('MAIL_DRIVER', 'smtp'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SMTP Host Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may provide the host address of the SMTP server used by your
|
||||
| applications. A default option is provided that is compatible with
|
||||
| the Mailgun mail service which will provide reliable deliveries.
|
||||
|
|
||||
*/
|
||||
|
||||
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SMTP Host Port
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the SMTP port used by your application to deliver e-mails to
|
||||
| users of the application. Like the host we have set this value to
|
||||
| stay compatible with the Mailgun e-mail application by default.
|
||||
|
|
||||
*/
|
||||
|
||||
'port' => env('MAIL_PORT', 587),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| E-Mail Encryption Protocol
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the encryption protocol that should be used when
|
||||
| the application send e-mail messages. A sensible default using the
|
||||
| transport layer security protocol should provide great security.
|
||||
|
|
||||
*/
|
||||
|
||||
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SMTP Server Username
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If your SMTP server requires a username for authentication, you should
|
||||
| set it here. This will get used to authenticate with your server on
|
||||
| connection. You may also set the "password" value below this one.
|
||||
|
|
||||
*/
|
||||
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sendmail System Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "sendmail" driver to send e-mails, we will need to know
|
||||
| the path to where Sendmail lives on this server. A default path has
|
||||
| been provided here, which will work well on most of your systems.
|
||||
|
|
||||
*/
|
||||
|
||||
'sendmail' => '/usr/sbin/sendmail -bs',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'),
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you are using the "log" driver, you may specify the logging channel
|
||||
| if you prefer to keep mail messages separate from other log entries
|
||||
| for simpler reading. Otherwise, the default channel will be used.
|
||||
|
|
||||
*/
|
||||
|
||||
'log_channel' => env('MAIL_LOG_CHANNEL'),
|
||||
|
||||
];
|
||||
88
config/queue.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?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'),
|
||||
'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'),
|
||||
'database' => env('DB_CONNECTION', 'mysql'),
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
||||
];
|
||||
33
config/services.php
Normal 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'),
|
||||
],
|
||||
|
||||
];
|
||||
199
config/session.php
Normal file
@@ -0,0 +1,199 @@
|
||||
<?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
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "apc", "memcached", or "dynamodb" session drivers 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".
|
||||
|
|
||||
*/
|
||||
|
||||
'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', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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
|
||||
| do not enable this as other CSRF protection services are in place.
|
||||
|
|
||||
| Supported: "lax", "strict", "none"
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => 'lax',
|
||||
|
||||
];
|
||||
116
config/ueditor.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the overtrue/laravel-ueditor.
|
||||
*
|
||||
* (c) overtrue <i@overtrue.me>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
return [
|
||||
// 存储引擎: config/filesystem.php 中 disks, public 或 qiniu
|
||||
'disk' => 'public',
|
||||
'route' => [
|
||||
'name' => '/ueditor/server',
|
||||
'options' => [
|
||||
// middleware => 'auth',
|
||||
],
|
||||
],
|
||||
|
||||
// 上传 配置
|
||||
'upload' => [
|
||||
/* 前后端通信相关的配置,注释只允许使用多行方式 */
|
||||
/* 上传图片配置项 */
|
||||
'imageActionName' => 'upload-image', /* 执行上传图片的action名称 */
|
||||
'imageFieldName' => 'upfile', /* 提交的图片表单名称 */
|
||||
'imageMaxSize' => 2 * 1024 * 1024, /* 上传大小限制,单位B */
|
||||
'imageAllowFiles' => ['.png', '.jpg', '.jpeg', '.gif', '.bmp'], /* 上传图片格式显示 */
|
||||
'imageCompressEnable' => true, /* 是否压缩图片,默认是true */
|
||||
'imageCompressBorder' => 1600, /* 图片压缩最长边限制 */
|
||||
'imageInsertAlign' => 'none', /* 插入的图片浮动方式 */
|
||||
'imageUrlPrefix' => '', /* 图片访问路径前缀 */
|
||||
'imagePathFormat' => '/uploads/image/{yyyy}/{mm}/{dd}/', /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||
/* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */
|
||||
/* {rand:6} 会替换成随机数,后面的数字是随机数的位数 */
|
||||
/* {time} 会替换成时间戳 */
|
||||
/* {yyyy} 会替换成四位年份 */
|
||||
/* {yy} 会替换成两位年份 */
|
||||
/* {mm} 会替换成两位月份 */
|
||||
/* {dd} 会替换成两位日期 */
|
||||
/* {hh} 会替换成两位小时 */
|
||||
/* {ii} 会替换成两位分钟 */
|
||||
/* {ss} 会替换成两位秒 */
|
||||
/* 非法字符 \ => * ? " < > | */
|
||||
/* 具请体看线上文档 => fex.baidu.com/assets/#use-format_upload_filename */
|
||||
|
||||
/* 涂鸦图片上传配置项 */
|
||||
'scrawlActionName' => 'upload-scrawl', /* 执行上传涂鸦的action名称 */
|
||||
'scrawlFieldName' => 'upfile', /* 提交的图片表单名称 */
|
||||
'scrawlPathFormat' => '/uploads/image/{yyyy}/{mm}/{dd}/', /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||
'scrawlMaxSize' => 2048000, /* 上传大小限制,单位B */
|
||||
'scrawlUrlPrefix' => '', /* 图片访问路径前缀 */
|
||||
'scrawlInsertAlign' => 'none',
|
||||
|
||||
/* 截图工具上传 */
|
||||
'snapscreenActionName' => 'upload-image', /* 执行上传截图的action名称 */
|
||||
'snapscreenPathFormat' => '/uploads/image/{yyyy}/{mm}/{dd}/', /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||
'snapscreenUrlPrefix' => '', /* 图片访问路径前缀 */
|
||||
'snapscreenInsertAlign' => 'none', /* 插入的图片浮动方式 */
|
||||
|
||||
/* 抓取远程图片配置 */
|
||||
'catcherLocalDomain' => ['127.0.0.1', 'localhost', 'img.baidu.com'],
|
||||
'catcherActionName' => 'catch-image', /* 执行抓取远程图片的action名称 */
|
||||
'catcherFieldName' => 'source', /* 提交的图片列表表单名称 */
|
||||
'catcherPathFormat' => '/uploads/image/{yyyy}/{mm}/{dd}/', /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||
'catcherUrlPrefix' => '', /* 图片访问路径前缀 */
|
||||
'catcherMaxSize' => 2048000, /* 上传大小限制,单位B */
|
||||
'catcherAllowFiles' => ['.png', '.jpg', '.jpeg', '.gif', '.bmp'], /* 抓取图片格式显示 */
|
||||
|
||||
/* 上传视频配置 */
|
||||
'videoActionName' => 'upload-video', /* 执行上传视频的action名称 */
|
||||
'videoFieldName' => 'upfile', /* 提交的视频表单名称 */
|
||||
'videoPathFormat' => '/uploads/video/{yyyy}/{mm}/{dd}/', /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||
'videoUrlPrefix' => '', /* 视频访问路径前缀 */
|
||||
'videoMaxSize' => 102400000, /* 上传大小限制,单位B,默认100MB */
|
||||
'videoAllowFiles' => [
|
||||
'.flv', '.swf', '.mkv', '.avi', '.rm', '.rmvb', '.mpeg', '.mpg',
|
||||
'.ogg', '.ogv', '.mov', '.wmv', '.mp4', '.webm', '.mp3', '.wav', '.mid', ], /* 上传视频格式显示 */
|
||||
|
||||
/* 上传文件配置 */
|
||||
'fileActionName' => 'upload-file', /* controller里,执行上传视频的action名称 */
|
||||
'fileFieldName' => 'upfile', /* 提交的文件表单名称 */
|
||||
'filePathFormat' => '/uploads/file/{yyyy}/{mm}/{dd}/', /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||
'fileUrlPrefix' => '', /* 文件访问路径前缀 */
|
||||
'fileMaxSize' => 51200000, /* 上传大小限制,单位B,默认50MB */
|
||||
'fileAllowFiles' => [
|
||||
'.png', '.jpg', '.jpeg', '.gif', '.bmp',
|
||||
'.flv', '.swf', '.mkv', '.avi', '.rm', '.rmvb', '.mpeg', '.mpg',
|
||||
'.ogg', '.ogv', '.mov', '.wmv', '.mp4', '.webm', '.mp3', '.wav', '.mid',
|
||||
'.rar', '.zip', '.tar', '.gz', '.7z', '.bz2', '.cab', '.iso',
|
||||
'.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.pdf', '.txt', '.md', '.xml',
|
||||
], /* 上传文件格式显示 */
|
||||
|
||||
/* 列出指定目录下的图片 */
|
||||
'imageManagerActionName' => 'list-image', /* 执行图片管理的action名称 */
|
||||
'imageManagerListPath' => '/uploads/image/', /* 指定要列出图片的目录 */
|
||||
'imageManagerListSize' => 20, /* 每次列出文件数量 */
|
||||
'imageManagerUrlPrefix' => '', /* 图片访问路径前缀 */
|
||||
'imageManagerInsertAlign' => 'none', /* 插入的图片浮动方式 */
|
||||
'imageManagerAllowFiles' => ['.png', '.jpg', '.jpeg', '.gif', '.bmp'], /* 列出的文件类型 */
|
||||
|
||||
/* 列出指定目录下的文件 */
|
||||
'fileManagerActionName' => 'list-file', /* 执行文件管理的action名称 */
|
||||
'fileManagerListPath' => '/uploads/file/', /* 指定要列出文件的目录 */
|
||||
'fileManagerUrlPrefix' => '', /* 文件访问路径前缀 */
|
||||
'fileManagerListSize' => 20, /* 每次列出文件数量 */
|
||||
'fileManagerAllowFiles' => [
|
||||
'.png', '.jpg', '.jpeg', '.gif', '.bmp',
|
||||
'.flv', '.swf', '.mkv', '.avi', '.rm', '.rmvb', '.mpeg', '.mpg',
|
||||
'.ogg', '.ogv', '.mov', '.wmv', '.mp4', '.webm', '.mp3', '.wav', '.mid',
|
||||
'.rar', '.zip', '.tar', '.gz', '.7z', '.bz2', '.cab', '.iso',
|
||||
'.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.pdf', '.txt', '.md', '.xml',
|
||||
], /* 列出的文件类型 */
|
||||
],
|
||||
];
|
||||
36
config/view.php
Normal 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
@@ -0,0 +1,2 @@
|
||||
*.sqlite
|
||||
*.sqlite-journal
|
||||
28
database/factories/UserFactory.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use App\User;
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This directory should contain each of the model factory definitions for
|
||||
| your application. Factories provide a convenient way to generate new
|
||||
| model instances for testing / seeding your application's database.
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(User::class, function (Faker $faker) {
|
||||
return [
|
||||
'name' => $faker->name,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
});
|
||||
36
database/migrations/2014_10_12_000000_create_users_table.php
Normal 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->bigIncrements('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');
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
119
database/migrations/2016_01_04_173148_create_admin_tables.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAdminTables extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getConnection()
|
||||
{
|
||||
return config('admin.database.connection') ?: config('database.default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(config('admin.database.users_table'), function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('username', 190)->unique();
|
||||
$table->string('password', 60);
|
||||
$table->string('name');
|
||||
$table->string('avatar')->nullable();
|
||||
$table->string('remember_token', 100)->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create(config('admin.database.roles_table'), function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name', 50)->unique();
|
||||
$table->string('slug', 50)->unique();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create(config('admin.database.permissions_table'), function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name', 50)->unique();
|
||||
$table->string('slug', 50)->unique();
|
||||
$table->string('http_method')->nullable();
|
||||
$table->text('http_path')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create(config('admin.database.menu_table'), function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('parent_id')->default(0);
|
||||
$table->integer('order')->default(0);
|
||||
$table->string('title', 50);
|
||||
$table->string('icon', 50);
|
||||
$table->string('uri')->nullable();
|
||||
$table->string('permission')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create(config('admin.database.role_users_table'), function (Blueprint $table) {
|
||||
$table->integer('role_id');
|
||||
$table->integer('user_id');
|
||||
$table->index(['role_id', 'user_id']);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create(config('admin.database.role_permissions_table'), function (Blueprint $table) {
|
||||
$table->integer('role_id');
|
||||
$table->integer('permission_id');
|
||||
$table->index(['role_id', 'permission_id']);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create(config('admin.database.user_permissions_table'), function (Blueprint $table) {
|
||||
$table->integer('user_id');
|
||||
$table->integer('permission_id');
|
||||
$table->index(['user_id', 'permission_id']);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create(config('admin.database.role_menu_table'), function (Blueprint $table) {
|
||||
$table->integer('role_id');
|
||||
$table->integer('menu_id');
|
||||
$table->index(['role_id', 'menu_id']);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create(config('admin.database.operation_log_table'), function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('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(config('admin.database.users_table'));
|
||||
Schema::dropIfExists(config('admin.database.roles_table'));
|
||||
Schema::dropIfExists(config('admin.database.permissions_table'));
|
||||
Schema::dropIfExists(config('admin.database.menu_table'));
|
||||
Schema::dropIfExists(config('admin.database.user_permissions_table'));
|
||||
Schema::dropIfExists(config('admin.database.role_users_table'));
|
||||
Schema::dropIfExists(config('admin.database.role_permissions_table'));
|
||||
Schema::dropIfExists(config('admin.database.role_menu_table'));
|
||||
Schema::dropIfExists(config('admin.database.operation_log_table'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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->bigIncrements('id');
|
||||
$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');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateArticlesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('articles', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('articles');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCategoriesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('categories', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('categories');
|
||||
}
|
||||
}
|
||||
31
database/migrations/2020_05_28_163818_create_links_table.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateLinksTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('links', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('links');
|
||||
}
|
||||
}
|
||||
16
database/seeds/DatabaseSeeder.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// $this->call(UsersTableSeeder::class);
|
||||
}
|
||||
}
|
||||
21
public/.htaccess
Normal 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]
|
||||
|
||||
# Handle Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
||||
194
public/assets/index/css/style.css
Normal file
@@ -0,0 +1,194 @@
|
||||
@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}
|
||||
.clear{ clear:both}
|
||||
body{ font-family:"微软雅黑"; width:100%; min-width:1200px;color: #333;font-size: 14px;}
|
||||
.ccsl{ display:block;overflow:hidden; white-space:nowrap;text-overflow:ellipsis;}
|
||||
p{text-align:justify}
|
||||
|
||||
.main{ width:1200px; margin:0 auto;}
|
||||
|
||||
|
||||
.banner{ width:100%; min-width:1200px; /*height:400px;*/ overflow:hidden; position:relative;font-size:0; margin:0 auto;}
|
||||
.b-img{ /*height:400px;*/ position:absolute; left:0; top:0;}
|
||||
.b-img img{ display:block; /*height:400px;*/ float:left;}
|
||||
.b-list{ height:20px; /*padding-top:380px;*/ margin:0 auto;position:relative;z-index:1;}
|
||||
.b-list span{ display:block;cursor:pointer; width:10px; height:10px; border-radius:50%; background:#fff; float:left; margin:0 5px; _margin:0 3px;}
|
||||
.b-list .spcss{ background:#0580c8}
|
||||
|
||||
.topbox{ width:100%; min-width:1200px; height:40px; line-height:40px; overflow:hidden;background:#ededed;}
|
||||
.topbox p{ width:1200px; margin:0 auto; font-size:14px; color:#333;}
|
||||
|
||||
.logo{ width:1200px; margin:0 auto; overflow:hidden}
|
||||
.logo img{ display:block; width:1200px;}
|
||||
|
||||
.nav{width:100%; min-width:1200px; overflow:hidden;background: #0580c8;height: 54px;}
|
||||
.nav ul{ overflow:hidden}
|
||||
.nav ul li{ float:left;width: 125px;height: 54px;text-align: center;line-height: 54px; overflow:hidden; margin-right:1px}
|
||||
.nav ul li a{color: #fff;font-size: 15px; display:block}
|
||||
.nav ul li:hover,.nav ul li.on{ background:rgb(74, 136, 207)}
|
||||
|
||||
.part1{margin: 20px auto; width:1200px;color: #666;font-size: 14px;line-height: 28px; height:28px; overflow:hidden}
|
||||
.part1 span{ display:block; float:left; font-weight:bold;}
|
||||
.part1 .con{ float:left; max-width:1000px; overflow:hidden}
|
||||
.part1 .con a{ display:inline-block;color: #666; padding-right:5px}
|
||||
|
||||
.part2{ width:100%; min-width:1200px;background:#F3F3F3; padding:20px 0}
|
||||
.part2 .titbox{width: 340px;margin: 20px auto;height: 65px;text-align: center; overflow:hidden}
|
||||
.part2 .titbox p{ text-align:center;color: #0580c8;font-weight:bold;font-size: 30px;}
|
||||
.part2 .titbox em{font-style:normal;text-transform: uppercase;color: #afb2af;font-size: 14px;font-family: arial;text-align: center;margin-left: 10px;}
|
||||
|
||||
.part2 ul{ padding-bottom:20px; overflow:hidden}
|
||||
.part2 ul li{background: #fff;width: 285px;height: 324px;float: left;margin: 10px 20px 10px 0;overflow: hidden;}
|
||||
.part2 ul li:nth-child(4n){ margin-right:0}
|
||||
.part2 ul li img{margin: 10px 10px 0 10px;width: 265px;height: 265px;}
|
||||
.part2 ul li p{ text-align:center;line-height: 48px;color: #333; font-size: 16px;}
|
||||
.part2 ul li:hover p{color: #0580c8;}
|
||||
|
||||
.part3{ padding-top:46px; width:1200px; margin:0 auto; overflow:hidden; padding-bottom:20px}
|
||||
.part3 .titbox{width: 600px;margin:0 auto;text-align: center;}
|
||||
.part3 .titbox p{padding-top: 18px; font-weight:bold;font-size: 28px;color: #000;text-align: center;}
|
||||
.part3 .titbox span{font-style:normal;text-transform: uppercase;color: #afb2af;font-size: 14px;font-family: arial;text-align: center;line-height: 34px;}
|
||||
.part3box{ padding-top:30px;}
|
||||
.part3box .p3L{border: 10px solid #eee;width: 315px;height: 216px;margin-right: 20px;float: left; overflow:hidden}
|
||||
.part3box .p3L img{width: 315px;height: 216px;}
|
||||
.part3box .p3R{width: 845px;float: left; padding-top: 10px;}
|
||||
.part3box .p3R .con{color: #666666;font-size: 14px;line-height: 2;margin-bottom: 10px; max-height:170px; overflow:hidden}
|
||||
.part3box .p3R a.more{border-radius: 20px;padding: 2px 10px;background: #0580c8;color: #fff;margin-top: 10px;display: inline-block;}
|
||||
.part3box .p3R a.more:hover{background: #ccc;color: #000;transition: all .5s;}
|
||||
.marqueeleft{width:1200px;overflow:hidden; padding-top:40px}
|
||||
.marqueeleft ul{float:left;}
|
||||
.marqueeleft li{float:left;display:inline;height:128px;overflow:hidden; padding-right:20px }
|
||||
|
||||
|
||||
.part4{width:100%; min-width:1200px; background:url(../images/bg.jpg) repeat;padding: 43px 0;margin: 20px auto;}
|
||||
.part4box{ float:left;width: 582px;overflow: hidden;}
|
||||
.part4box .titbox{ height:27px; overflow:hidden; line-height:27px;}
|
||||
.part4box .titbox h2{ float:left;color: #0580c8;font-size: 18px;font-weight: normal; max-width:450px; overflow:hidden;border-left: 4px solid #0580c8; padding-left: 10px;}
|
||||
.part4box .titbox a{ float:right;color: #333;font-size: 14px;}
|
||||
|
||||
.part4box .cons{background: #fff;margin-top: 20px;padding: 10px;}
|
||||
.p4one{ height:147px; overflow:hidden}
|
||||
.p4one .p4oneL{width:183px; height:137px;float: left;margin-right: 10px;margin-bottom: 10px; overflow:hidden}
|
||||
.p4one .p4oneL img{width:183px; height:137px;}
|
||||
.p4one .p4oneR{width: 350px;height:137px;float: right; overflow:hidden}
|
||||
.p4one .p4oneR a{font-weight: bold;color: #333;font-size: 14px;margin: 10px 0; float:left; max-width:250px;}
|
||||
.p4one .p4oneR span{ margin:10px 0; float:right;font-weight: normal;font-size: 14px;color: #666;}
|
||||
.p4one .p4oneR .sub{font-size: 14px;line-height: 1.8; height:75px; overflow:hidden}
|
||||
.p4one .p4oneR a:hover{ color:#0580c8}
|
||||
|
||||
.part4 ul{ padding-top:15px; overflow:hidden}
|
||||
.part4 ul li{line-height:35px; overflow:hidden;height:35px;border-bottom: 1px dotted #ccc;}
|
||||
.part4 ul li p{background: #0580c8;width: 14px;height: 14px;border-radius: 50%;float: left;text-align: center;color: #fff;margin-right: 15px;line-height: 14px;margin-top: 10px; font-size:14px;}
|
||||
.part4 ul li a{ float:left;color: #333;font-size: 14px; max-width:410px;}
|
||||
.part4 ul li span{ float:right;color: #666;font-size: 14px;}
|
||||
.part4 ul li:hover p{background: #ccc;color: #000; transition: all .5s;}
|
||||
.part4 ul li:hover a{color: #0580c8;transition: all .5s;}
|
||||
.part4 ul li:hover span{color: #0580c8; transition: all .5s;}
|
||||
|
||||
.part4box.fr{ float:right}
|
||||
|
||||
|
||||
.linkbox{margin: 40px auto; width:1200px; overflow:hidden}
|
||||
.linkbox .linkL{ width:81px; height:70px; overflow:hidden; float:left}
|
||||
.linkbox .linkL .p1{ width:73px; height:35px; padding-left:8px; line-height:35px; color:#fff; font-size:14px; background:url(../images/icon.png) no-repeat}
|
||||
.linkbox .linkL .p2{width:73px; height:35px; padding-left:8px;color:#fff; line-height:35px; font-size:14px; background:url(../images/icon2.png) no-repeat}
|
||||
.linkbox .linkR{width: 1096px;float: right;border: 1px solid #ccc; height: 50px;padding: 10px;font-size: 14px;line-height: 2;overflow: hidden;}
|
||||
.linkbox .linkR a{color: #797979;margin: 0 5px;display: inline-block;}
|
||||
|
||||
|
||||
.footer{width:100%; min-width:1200px; background: #000;padding: 20px 0;font-size: 14px;}
|
||||
.fnav{ color:#a2a2a2; max-width:1200px; margin:0 auto; text-align:center}
|
||||
.fnav a{display: inline-block;line-height: 2;margin: 0 5px 20px;color: #fff;}
|
||||
.foot{ text-align:center;color: #a2a2a2; line-height:2}
|
||||
|
||||
|
||||
.mainWarp{ width:1200px; margin:0 auto;margin: 40px auto;}
|
||||
.mainLeft{float: left;width: 220px;}
|
||||
.typebox{border: 2px solid #0580c8;width: 212px;min-height:50px;background: #fcfcfc;}
|
||||
.typebox .tit{background:#0580c8;color: #fff;font-size: 18px;font-weight: normal;line-height: 2.5;}
|
||||
.typebox .tit p{ text-align:center}
|
||||
.typebox ul{ overflow:hidden;margin-top: 20px;margin-bottom: 10px;}
|
||||
.typebox ul li{background: #e1e1e1;margin: 10px 15px;line-height:35px;font-size: 14px; height:35px;}
|
||||
.typebox ul li a{ float:left;color: #444444; max-width:140px;}
|
||||
.typebox ul li p{ float:left;margin: 12px 10px;background: #000;border-radius: 50%;width: 12px;height: 12px;color: #fff;line-height: 0.8;text-align: center;}
|
||||
.typebox ul li:hover{background: #0580c8; transition: all .5s;}
|
||||
.typebox ul li:hover p{background: #fff;color: #000; transition: all .5s;}
|
||||
.typebox ul li:hover a{color: #fff;transition: all .5s;}
|
||||
|
||||
.mainLeft .titboxcon{border-left: 4px solid #0580c8; height:27px;padding-left: 10px;margin:20px 0 10px; overflow:hidden}
|
||||
.mainLeft .titboxcon p{font-size: 18px;color: #0580c8;}
|
||||
.mainLeft .lxwm{}
|
||||
.mainLeft .lxwm .con{line-height: 2; padding-top:10px}
|
||||
ul.newsul{ overflow:hidden}
|
||||
ul.newsul li{ height:35px;line-height:35px;color: #666; border-bottom:1px dashed #ddd}
|
||||
ul.newsul li a{ color:#666}
|
||||
ul.newsul li a:hover{ color:#0580c8}
|
||||
|
||||
|
||||
|
||||
.mainRight{ float:right; width:962px; overflow:hidden}
|
||||
.brandnav{width: 950px;border: 1px solid #ccc;padding: 5px; height:25px; line-height:25px; overflow:hidden}
|
||||
.brandnav p{ float:left;color: #0580c8;font-size: 16px;font-weight: normal;padding-left: 10px; max-width:200px;}
|
||||
.brandnav .con{ float:right; font-size:14px; color:#333; max-width:300px}
|
||||
|
||||
ul.piclistul{padding: 15px;width: 930px; border: 1px solid #ccc;margin-top: 10px;min-height:300px; overflow:hidden}
|
||||
ul.piclistul li{ width:217px; height:192px; overflow:hidden; float:left; margin:10px 8px}
|
||||
ul.piclistul li .proimg{ width:215px; height:160px;_display:table;display:table-cell;text-align:center;border:1px solid #ddd;vertical-align:middle}
|
||||
ul.piclistul li .proimg img{vertical-align:middle;max-height:160px; max-width:215px;}
|
||||
ul.piclistul li p{ text-align:center;line-height: 30px; color:#333; padding:0 10px}
|
||||
ul.piclistul li:nth-child(4n){ margin-right:0}
|
||||
ul.piclistul li:hover p{color: #0580c8;}
|
||||
ul.piclistul li:hover .proimg{ border:1px solid #0580c8}
|
||||
|
||||
|
||||
|
||||
ul.listul{padding: 15px 35px; overflow:hidden;border: 1px solid #ccc;margin-top: 10px;min-height:300px;}
|
||||
ul.listul li{ height:36px; line-height: 36px;border-bottom: 1px dotted #CCC;}
|
||||
ul.listul li p{background: #0580c8;width: 14px; height: 14px; border-radius: 50%;float: left;text-align: center;color: #fff;margin-right: 15px;line-height: 12px;margin-top: 12px;}
|
||||
ul.listul li a{ float:left;color: #333; max-width:600px;font-size: 14px;}
|
||||
ul.listul li span{ float:right;color: #666;font-size: 13px;}
|
||||
|
||||
|
||||
.detailbox{padding: 15px;border: 1px solid #ccc;margin-top: 10px;min-height:70vh; overflow:hidden}
|
||||
.detailbox .xq{}
|
||||
.detailbox .xq h1{font-size: 20px;line-height: 40px;text-align: center;color: #0580c8;}
|
||||
.detailbox .xq .date{margin: 10px 0;padding: 5px 10px;font-size: 14px;line-height: 24px;color: #666;text-align: center;border: 1px dotted #ccc;}
|
||||
.detailbox .xq .con{padding: 10px;line-height:30px; padding-bottom:20px}
|
||||
.detailbox .xq .prroimg{ display:block; margin:0 auto; max-width:650px; padding:10px 0}
|
||||
|
||||
|
||||
|
||||
.pagebox{ text-align:center; padding-top:30px; padding-bottom:50px}
|
||||
.pagebox a{ border:1px solid #ccc; padding:5px 10px; display:inline-block; color:#333; margin:3px}
|
||||
.pagebox a:hover{background:#0580c8; color:#fff}
|
||||
.pagebox a.on{ background:#0580c8; color:#fff}
|
||||
|
||||
.imgcenter{display: flex; flex-direction: row; justify-content: center;align-items: center;box-sizing: border-box;}
|
||||
.imgcenter li{width: 400px !important; }
|
||||
.imgcenter li img{width: 400px !important;}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
public/assets/index/images/1.jpg
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
public/assets/index/images/2.jpg
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
public/assets/index/images/3.jpg
Normal file
|
After Width: | Height: | Size: 78 KiB |
BIN
public/assets/index/images/4.jpg
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
public/assets/index/images/5.jpg
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
public/assets/index/images/Thumbs.db
Normal file
BIN
public/assets/index/images/banner.jpg
Normal file
|
After Width: | Height: | Size: 689 KiB |
BIN
public/assets/index/images/bg.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
public/assets/index/images/icon.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
public/assets/index/images/icon2.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
public/assets/index/images/images.rar
Normal file
BIN
public/assets/index/images/logo.jpg
Normal file
|
After Width: | Height: | Size: 87 KiB |
106
public/assets/index/js/banner.js
Normal file
@@ -0,0 +1,106 @@
|
||||
//全屏滚动
|
||||
window.onload=function(){
|
||||
var n=0;
|
||||
var imgLength=$(".b-img img").length;
|
||||
var ctWidth=imgLength*100;
|
||||
var itemWidth=1/imgLength*100;
|
||||
$(".b-img").width(ctWidth+"%");
|
||||
$(".b-img img").width(itemWidth+"%");
|
||||
$(".banner").height($(".b-img img:eq(0)")[0].height+"px");
|
||||
|
||||
$(".b-list").width(imgLength*30);
|
||||
|
||||
$(".b-list").css('padding-top',$(".b-img img:eq(0)")[0].height-20);
|
||||
|
||||
if(imgLength>1)
|
||||
{
|
||||
for(var i=0;i<imgLength;i++)
|
||||
{
|
||||
var listSpan=$("<span></span>")
|
||||
$(".b-list").append(listSpan);
|
||||
}
|
||||
}
|
||||
$(".b-list span:eq(0)").addClass("spcss").siblings("span").removeClass("spcss");
|
||||
$(".bar-right em").click(function(){
|
||||
if(n==imgLength-1)
|
||||
{
|
||||
var ctPosit=(n+1)*100;
|
||||
$(".banner").append($(".b-img").clone());
|
||||
$(".b-img:last").css("left","100%");
|
||||
$(".b-img:first").animate({"left":"-"+ctPosit+"%"},1000);
|
||||
$(".b-img:last").animate({"left":"0"},1000);
|
||||
var setTime0=setTimeout(function () {
|
||||
$(".banner .b-img:first").remove();
|
||||
}, 1000);
|
||||
n=0;
|
||||
$(".b-list span:eq("+n+")").addClass("spcss").siblings("span").removeClass("spcss");
|
||||
}
|
||||
else
|
||||
{
|
||||
n++;
|
||||
var ctPosit=n*100;
|
||||
$(".b-img").animate({"left":"-"+ctPosit+"%"},1000);
|
||||
$(".b-list span:eq("+n+")").addClass("spcss").siblings("span").removeClass("spcss");
|
||||
}
|
||||
})
|
||||
$(".bar-left em").click(function(){
|
||||
if(n==0)
|
||||
{
|
||||
var stPosit=imgLength*100;
|
||||
var etPosit=(imgLength-1)*100;
|
||||
$(".banner").prepend($(".b-img").clone());
|
||||
$(".b-img:first").css("left","-"+stPosit+"%");
|
||||
$(".b-img:last").animate({"left":"100%"},1000);
|
||||
$(".b-img:first").animate({"left":"-"+etPosit+"%"},1000);
|
||||
var setTime0=setTimeout(function () {
|
||||
$(".banner .b-img:last").remove();
|
||||
}, 1000);
|
||||
n=imgLength-1;
|
||||
$(".b-list span:eq("+n+")").addClass("spcss").siblings("span").removeClass("spcss");
|
||||
}
|
||||
else
|
||||
{
|
||||
n--;
|
||||
var ctPosit=n*100;
|
||||
$(".b-img").animate({"left":"-"+ctPosit+"%"},1000);
|
||||
$(".b-list span:eq("+n+")").addClass("spcss").siblings("span").removeClass("spcss");
|
||||
}
|
||||
})
|
||||
$(".b-list span").click(function(){
|
||||
var lsIndex=$(this).index();
|
||||
n=lsIndex;
|
||||
var ctPosit=n*100;
|
||||
$(".b-img").animate({"left":"-"+ctPosit+"%"},1000);
|
||||
$(this).addClass("spcss").siblings("span").removeClass("spcss");
|
||||
})
|
||||
function rollEnvent(){
|
||||
if(n==imgLength-1)
|
||||
{
|
||||
var ctPosit=(n+1)*100;
|
||||
$(".banner").append($(".b-img").clone());
|
||||
$(".b-img:last").css("left","100%");
|
||||
$(".b-img:first").animate({"left":"-"+ctPosit+"%"},1000);
|
||||
$(".b-img:last").animate({"left":"0"},1000);
|
||||
var setTime0=setTimeout(function () {
|
||||
$(".banner .b-img:first").remove();
|
||||
}, 1000);
|
||||
n=0;
|
||||
$(".b-list span:eq(0)").addClass("spcss").siblings("span").removeClass("spcss");
|
||||
}
|
||||
else
|
||||
{
|
||||
n++;
|
||||
var ctPosit=n*100;
|
||||
$(".b-img").animate({"left":"-"+ctPosit+"%"},1000);
|
||||
$(".b-list span:eq("+n+")").addClass("spcss").siblings("span").removeClass("spcss");
|
||||
}
|
||||
}
|
||||
var slidesetInterval=setInterval(rollEnvent,4000);
|
||||
$(".banner").hover(function(){clearInterval(slidesetInterval);},function(){slidesetInterval=setInterval(rollEnvent,4000);});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||