Commit cdda46fe by mushishixian

Initial commit

parents
Showing with 4723 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.yml]
indent_size = 2
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/.history
/.idea
_ide_helper.php
_ide_helper_models.php
.phpstorm.meta.php
php:
preset: laravel
disabled:
- unused_use
finder:
not-name:
- index.php
- server.php
js:
finder:
not-name:
- webpack.mix.js
css: true
<?php
namespace App\Admin\Controllers;
use App\Admin\RowActions\ClearActivityCache;
use App\Admin\RowActions\CopyActivity;
use App\Admin\RowActions\PublishActivity;
use App\Models\Activity;
use App\Models\AdminUsers;
use App\Models\GiftActivity;
use App\Models\Log;
use App\Models\ModuleTemplet;
use App\Models\StaffRecords;
use App\Models\UserInfo;
use App\Models\UserWrite;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\AdminController;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Redis;
class ActivityController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(Activity::with(['modules', 'user_info']), function (Grid $grid) {
$grid->listen(Grid\Events\Fetched::class, function ($grid, Collection $rows) {
$rows->transform(function ($row) {
//判断是否过期
$row['is_expired'] = $row['end_time'] < time() ? 2 : 1;
//判断是否有缓存
$row['has_cached'] = Redis::get('Activity_' . $row['id']) ? 1 : 0;
return $row;
});
});
$grid->quickSearch('name')->placeholder('快速搜索活动名称');
$grid->actions([new CopyActivity(Activity::class)]);
$grid->actions([new PublishActivity(Activity::class)]);
$grid->actions([new ClearActivityCache(Activity::class)]);
$grid->paginate(15);
$grid->showRowSelector();
$grid->rowSelector()->click();
$grid->rowSelector()->background('#DDF2E9');
$grid->column('id', 'ID')->sortable();
$grid->column('name', '活动名称')->editable();
$grid->column('type', '活动类型')->display(function ($type) {
return Arr::get(config('field.activity_type'), $type);
});
$grid->column('modules', '模块列表')->display(function ($modules) {
$modules = $modules->toArray();
$moduleList = array_column($modules, 'title');
$moduleList = array_map(function ($name) {
return $name ?: "未命名模块";
}, $moduleList);
$moduleList = implode(' | ', $moduleList);
return $moduleList;
})->limit(10)->width('10%');
$grid->column('sign', '活动标签')->copyable();
$grid->column('activity_time', '活动时间')->display(function () {
return date('Y-m-d H:i:s', $this->start_time) . ' ~ ' . date('Y-m-d H:i:s', $this->end_time);
});
$grid->column('activity_url', '活动地址')->view('admin.fields.url_button');
$grid->column('is_expired', '是否过期')->using([1 => '未过期', 2 => '已过期'])->dot([
1 => 'primary',
2 => 'danger',
]);
$grid->column('status', '状态')->using(config('field.status'))->dot([
1 => 'info',
2 => 'primary',
3 => 'danger',
])->sortable();
$grid->column('add_time', '创建时间')->date()->sortable();
$grid->column('user_info.name', '发布人');
$this->filter($grid);
$grid->model()->where('status', '!=', 3)->orderBy('id', 'desc');
});
}
private function filter($grid)
{
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->equal('id', '活动ID')->width(3);
$filter->equal('sign', '活动标签')->width(3);
// 设置datetime类型
$filter->equal('type', '活动类型')->select(config('field.activity_type'))->width(3);
$filter->where('是否过期', function ($query) {
$isExpired = $this->input;
$isExpired ? $query->where('end_time', '<', \time()) : $query->where('end_time', '>', \time());
})->select([0 => '未过期', 1 => '已过期'])->width(3);
$filter->in('status', '活动状态')
->multipleSelect(config('field.status'))->width(3);
$filter->between('end_time', '活动时间')->datetime()->width(6);
});
return $grid;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Activity(), function (Form $form) {
$form->disableResetButton();
$form->fieldset('活动通用信息', function (Form $form) {
$form->text('name', '活动名称')->required();
$form->select('type', '活动分类')->options(config('field.activity_type'))->required();
$form->text('name', '活动地址')->help('只能使用英文,且此名称会用在url中,上线后不可修改。')->required();
$form->radio('platform', '活动平台')->options(config('field.activity_platform'))->required();
$form->datetimeRange('start_time', 'end_time', '活动日期')->saving(function ($v) {
return ['start' => strtotime($v['start']), 'end' => strtotime($v['end'])];
})->customFormat(function ($v) {
return ['start' => date('Y-m-d H:i:s', $v['start']), 'end' => date('Y-m-d H:i:s', $v['end'])];
})->required();
$form->color('bg_color', '专题背景色')->width(4);
$form->color('font_color', '栏目字体颜色')->width(4)->help('this is demo');
$form->checkbox('page_modules', '页面小模块')->options(config('field.page_modules'));
});
$form->fieldset('SEO信息', function (Form $form) {
$form->textarea('title', '页面标题')->help('建议30字以内');
$form->textarea('keyword', '页面关键词')->help('用英文逗号,隔开建议5-6个关键词');
$form->textarea('describe', '页面标题')->help('建议100字以内');
})->collapsed();
$form->fieldset('分享信息', function (Form $form) {
$form->textarea('share_title', '分享标题')->help('目前此部分分享的内容,仅限于手机端分享时使用。');
$form->textarea('share_describe', '分享描述');
$form->image('share_img', '分享图片')->accept('png,jpg,gif')->autoUpload()->removable()->width(3)
->url('upload')->help('支持扩展名png/jpg/gif,建议尺寸283*123');
$form->image('share_float', '分享浮标')->accept('png,jpg,gif')->autoUpload()->removable()->width(3)
->url('upload')->help('支持扩展名png/jpg/gif,建议尺寸450*360');
});
$model = $this->form()->model();
$form->saving(function () use ($model) {
$model->created_at = time();
});
});
}
}
<?php
namespace App\Admin\Controllers;
use Dcat\Admin\Http\Controllers\AuthController as BaseAuthController;
class AuthController extends BaseAuthController
{
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\GiftActivity;
use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\AdminController;
class GiftActivityStatisticsController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new GiftActivity(), function (Grid $grid) {
$grid->disableCreateButton();
$grid->disableDeleteButton();
$grid->column('id', '活动ID')->sortable();
$grid->column('activity_name', '活动名称');
$grid->column('activity_time', '活动时间')->display(function () {
return date('Y-m-d H:i:s', $this->start_time) . ' ~ ' . date('Y-m-d H:i:s', $this->end_time);
});
$grid->column('statistics.new_user_num', '新用户数');
$grid->column('statistics.order_num', '订单数量');
$grid->column('status', '活动状态')->using(config('field.new_activity_status'))->label([
1 => 'info',
0 => 'primary',
-1 => 'danger',
]);
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->like('activity_name', '活动名称')->width(3);
$filter->equal('id', '活动ID')->width(3);
$filter->between('end_time', '活动时间')->date()->width(3);
$filter->equal('user_scope', '促销用户范围')->select([
1 => '所有用户',
2 => '登陆用户',
])->width(3);
$filter->equal('goods_scope', '促销商品范围')->select([
1 => '自营',
2 => '联营',
])->width(3);
$filter->equal('status', '活动状态')->select(config('field.new_activity_status'))->width(3);
});
$grid->model()->with('statistics')->orderBy('id', 'desc');
});
}
}
\ No newline at end of file
<?php
namespace App\Admin\Controllers;
use App\Admin\Metrics\Examples;
use App\Http\Controllers\Controller;
use Dcat\Admin\Http\Controllers\Dashboard;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Layout\Row;
class HomeController extends Controller
{
public function index(Content $content)
{
return $content
->header('Dashboard')
->description('Description...')
->body(function (Row $row) {
$row->column(6, function (Column $column) {
$column->row(Dashboard::title());
$column->row(new Examples\Tickets());
});
$row->column(6, function (Column $column) {
$column->row(function (Row $row) {
$row->column(6, new Examples\NewUsers());
$row->column(6, new Examples\NewDevices());
});
$column->row(new Examples\Sessions());
$column->row(new Examples\ProductOrders());
});
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\Log;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class LogController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Log(), function (Grid $grid) {
$grid->column('log_id', 'ID')->sortable();
$grid->column('admin_id', '操作人ID');
$grid->column('type', '操作类型')->using(config('field.log_type'))->label([
1 => 'info',
2 => 'primary',
3 => 'danger',
]);
$grid->column('table', '操作数据表');
$grid->column('key', '主键ID');
$grid->column('log', '操作描述');
$grid->column('add_time', '创建时间')->date()->sortable();
$grid->disableActions();
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
// $filter->equal('table','数据表')->select(config('field.log_activity_type'))->width(4);
$filter->equal('type', '操作类型')->select(config('field.log_type'))->width(4);
$filter->between('add_time', '操作时间')->datetime()->toTimestamp()->width(4);
});
$grid->model()->orderBy('log_id', 'desc');
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Log(), function (Show $show) {
$show->field('id');
$show->field('name');
$show->field('email');
$show->field('email_verified_at');
$show->field('password');
$show->field('remember_token');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Log(), function (Form $form) {
$form->display('id');
$form->text('supplier_name', '供应商名称')->required('供应商可能已经存在,建议先咨询审批人');
$form->text('supplier_en_name', '供应商英文名称')->help('供应商可能已经存在,建议先咨询审批人');
$form->checkbox('cooperate_type', '合作类型')->required()->options(config('field.page_modules'))->width(4);
$form->select('hangyexingzhi', '行业性质')->required()->options(config('field.page_modules'))->width(4);
$form->select('suoshuquiyu', '所属区域')->required()->options(config('field.page_modules'))->width(4);
$form->select('users', '渠道开发员')->required()->options(config('field.page_modules'))->width(4);
$form->multipleSelect('main_brand', '主营品牌')->required()->options(config('field.page_modules'))->width(6);
$form->multipleImage('company_license', '营业执照')->removable()->help('请上传小于5M的JPG/PNG格式图片');
$form->hasMany('联系方式', function (Form\NestedForm $form) {
$form->text('title','联系人')->required();
$form->text('body','座机号码');
$form->text('body1','职位');
$form->text('body2','邮箱');
$form->text('body3','手机号码');
$form->text('body4','传真');
$form->text('body5','QQ');
})->useTable();
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\Log;
use App\Admin\Repositories\MessageLog as RepositoriesMessageLog;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Show;
class MessageLogController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new RepositoriesMessageLog(), function (Grid $grid) {
$grid->column('ac_id', '活动ID')->sortable();
$grid->column('activity.name', '活动名称');
$grid->column('activity.sign', '活动地址');
$grid->column('mobile', '手机号码');
$grid->column('status', '状态')->using(config('field.message_remind_status'))->label([
1 => 'info',
2 => 'primary',
3 => 'danger',
4 => 'default',
]);
$grid->column('remind_time', '提醒时间按')->date()->sortable();
$grid->column('add_time', '创建时间')->date()->sortable();
$grid->disableActions();
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->equal('status', '状态')->select(config('field.message_remind_status'))->width(2);
$filter->equal('activity.sign', '活动地址')->width(2);
$filter->between('add_time', '推送时间')->datetime()->toTimestamp()->width(4);
});
$grid->model()->with('activity')->orderBy('id', 'desc');
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Log(), function (Show $show) {
$show->field('id');
$show->field('name');
$show->field('email');
$show->field('email_verified_at');
$show->field('password');
$show->field('remember_token');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Log(), function (Form $form) {
$form->display('id');
$form->text('supplier_name', '供应商名称')->required('供应商可能已经存在,建议先咨询审批人');
$form->text('supplier_en_name', '供应商英文名称')->help('供应商可能已经存在,建议先咨询审批人');
$form->checkbox('cooperate_type', '合作类型')->required()->options(config('field.page_modules'))->width(4);
$form->select('hangyexingzhi', '行业性质')->required()->options(config('field.page_modules'))->width(4);
$form->select('suoshuquiyu', '所属区域')->required()->options(config('field.page_modules'))->width(4);
$form->select('users', '渠道开发员')->required()->options(config('field.page_modules'))->width(4);
$form->multipleSelect('main_brand', '主营品牌')->required()->options(config('field.page_modules'))->width(6);
$form->multipleImage('company_license', '营业执照')->removable()->help('请上传小于5M的JPG/PNG格式图片');
$form->hasMany('联系方式', function (Form\NestedForm $form) {
$form->text('title', '联系人')->required();
$form->text('body', '座机号码');
$form->text('body1', '职位');
$form->text('body2', '邮箱');
$form->text('body3', '手机号码');
$form->text('body4', '传真');
$form->text('body5', 'QQ');
})->useTable();
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Http\Controllers\Controller;
use Dcat\Admin\Form;
use Dcat\Admin\Layout\Content;
class ModalFormController extends Controller
{
public function index(Content $content)
{
return $content
->header('Modal Form')
->body($this->build());
}
protected function build()
{
Form::dialog('新增角色')
->click('.create-form') // 绑定点击按钮
->url('auth/roles/create') // 表单页面链接,此参数会被按钮中的 “data-url” 属性替换。。
->width('700px') // 指定弹窗宽度,可填写百分比,默认 720px
->height('650px') // 指定弹窗高度,可填写百分比,默认 690px
->success('Dcat.reload()'); // 新增成功后刷新页面
Form::dialog('编辑角色')
->click('.edit-form')
->success('Dcat.reload()'); // 编辑成功后刷新页面
// 当需要在同个“class”的按钮中绑定不同的链接时,把链接放到按钮的“data-url”属性中即可
$editPage = admin_base_path('auth/roles/1/edit');
return "
<div style='padding:30px 0'>
<span class='btn btn-success create-form'> 新增表单弹窗 </span> &nbsp;&nbsp;
<span class='btn btn-blue edit-form' data-url='{$editPage}'> 编辑表单弹窗 </span>
</div>
";
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\ModuleTemplet;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Http\Controllers\HasResourceActions;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Show;
use Dcat\Admin\Widgets\Card;
class ModuleTemplatesController extends AdminController
{
use HasResourceActions;
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new ModuleTemplet(), function (Grid $grid) {
$grid->disableDeleteButton();
$grid->quickSearch('name')->placeholder('快速搜索模板名称');
$grid->column('id', 'ID');
$grid->column('name', '模板名称')->width('20%')->copyable();
$grid->column('sign', '视图标记')->label();
$grid->column('detail', '字段详情')->display("详情")->expand(function () {
$card = new Card(null, $this->detail);
return "<div style='padding:10px 10px 0'>$card</div>";
});
$grid->column('status', '是否启用')->switch();
$grid->column('add_time', '创建时间')->date()->sortable();
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('id');
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new ModuleTemplet(), function (Show $show) {
$show->field('id', 'ID');
$show->field('name', '模板名称');
$show->field('sign', '视图标记');
$show->field('detail', '字段详情')->width('30%');
$show->field('status', '是否启用');
});
}
public function edit($id, Content $content)
{
return $content
->header(trans('admin.roles'))
->description(trans('admin.edit'))
->body($this->form()->edit($id));
}
public function create(Content $content)
{
return $content
->header(trans('admin.roles'))
->description(trans('admin.create'))
->body($this->form());
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new ModuleTemplet(), function (Form $form) {
$form->disableViewButton();
$form->switch('status', '状态')->options([
1 => '禁用',
2 => '启用',
]);
$form->switch('level', '是否新模块')->options([
1 => '否',
2 => '是',
]);
$form->textarea('detail', '模块详情')->rules('json')->rows(30);
// $form->jsonEditor('detail','模块详情');
$form->display('add_time', '添加时间')->customFormat(function ($value) {
return date('Y-m-d H:i:s', $value);
});
});
}
}
\ No newline at end of file
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\PriceActivity;
use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\AdminController;
class PriceActivityStatisticsController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new PriceActivity(), function (Grid $grid) {
$grid->disableCreateButton();
$grid->disableDeleteButton();
$grid->column('id', '活动ID')->sortable();
$grid->column('activity_name', '活动名称');
$grid->column('show_name', '促销名称')->label();
$grid->column('activity_time', '活动时间')->display(function () {
return date('Y-m-d H:i:s', $this->start_time) . ' ~ ' . date('Y-m-d H:i:s', $this->end_time);
});
$grid->column('statistics.new_user_num', '新用户数');
$grid->column('statistics.order_num', '订单数量');
$grid->column('status', '活动状态')->using(config('field.new_activity_status'))->label([
1 => 'info',
0 => 'primary',
-1 => 'danger',
]);
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->like('activity_name', '活动名称')->width(3);
$filter->equal('id', '活动ID')->width(3);
$filter->between('end_time', '活动时间')->date()->width(3);
$filter->equal('user_scope', '促销用户范围')->select([
1 => '所有用户',
2 => '登陆用户',
])->width(3);
$filter->equal('goods_scope', '促销商品范围')->select([
1 => '自营',
2 => '联营',
])->width(3);
$filter->equal('status', '活动状态')->select(config('field.new_activity_status'))->width(3);
});
$grid->model()->with('statistics')->orderBy('id', 'desc');
});
}
}
\ No newline at end of file
<?php
namespace App\Admin\Controllers;
use App\Http\Controllers\Controller;
use GuzzleHttp\Client;
use Illuminate\Http\Request;
use App\Admin\Traits\Upload;
class UploadController extends Controller
{
public function upload(Request $request, Upload $upload)
{
$keys = $upload->generateUploadKeys();
$file = $request->file('_file_');
$client = new Client([
'base_url' => config('website.upload_url'),
'time_out' => 10
]);
$data = [
'form_params'=>[
'k1' => $keys['k1'],
'k2' => $keys['k2'],
'upload' => $file,
'source' => 1,
]
];
$response = $client->post(config('website.upload_url'), $data);
dd((string)$response->getBody());
}
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\User;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class UserController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new User(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('name');
$grid->column('email');
$grid->column('email_verified_at');
$grid->column('password');
$grid->column('remember_token');
$grid->column('created_at');
$grid->column('updated_at')->sortable();
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('id');
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new User(), function (Show $show) {
$show->field('id');
$show->field('name');
$show->field('email');
$show->field('email_verified_at');
$show->field('password');
$show->field('remember_token');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new User(), function (Form $form) {
$form->display('id');
$form->text('name');
$form->text('email');
$form->text('email_verified_at');
$form->text('password');
$form->text('remember_token');
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\User;
use App\Admin\Repositories\UserWrite;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class UserWriteController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new UserWrite(), function (Grid $grid) {
$grid->disableCreateButton();
$grid->disableDeleteButton();
$grid->column('id', 'ID')->sortable();
$grid->column('activity_id', '活动ID');
$grid->column('activity.name', '活动名称');
$grid->column('mobile', '会员账号');
$grid->column('company_name', '公司名称');
$grid->column('is_new_reg', '是否是新注册')->using([1 => '是', 0 => '否'])->label([
0 => 'danger',
1 => 'primary',
2 => 'info',
]);
$grid->column('add_time', '填写时间')->date();
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->equal('mobile', '会员账号')->width(3);
$filter->equal('activity_id', '活动ID')->width(3);
$filter->between('activity.end_time', '活动时间')->date()->width(3);
});
$grid->model()->with('activity')->orderBy('id', 'desc');
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new UserWrite(), function (Show $show) {
$show->field('id');
$show->field('activity_id', '活动ID');
$show->field('mobile', '会员账号');
$show->field('company_name', '公司名称');
$show->field('is_new_reg', '是否是新注册')->using([1 => '是', 2 => '否', 0 => '无'])->label([
0 => 'danger',
1 => 'info',
2 => 'primary',
]);
$show->field('add_time', '填写时间');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new UserWrite(), function (Form $form) {
$form->display('id', 'ID');
$form->text('activity_id');
$form->text('email');
$form->text('email_verified_at');
$form->text('password');
$form->text('remember_token');
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Extensions\Column;
use Dcat\Admin\Admin;
use Dcat\Admin\Grid\Displayers\AbstractDisplayer;
class JsonViewer extends AbstractDisplayer
{
public function display()
{
$script = <<<EOT
$('#json-renderer').jsonViewer({$this->value});
$('.json-viewer').click(function(){
Swal.fire({
width: '800px',
html: $('#json-renderer').html(),
})
});
EOT;
Admin::script($script);
Admin::js("js/extension/json-viewer/jquery.json-viewer.js");
Admin::css("js/extension/json-viewer/jquery.json-viewer.css");
return <<<EOT
<button type="button"
class="btn btn-sm btn-primary json-viewer"
title="json-viewer"
>
点击查看
</button>
<pre style="display: none" id="json-renderer">
</pre>
EOT;
}
}
<?php
namespace App\Admin\Extensions\Form;
use Dcat\Admin\Form\Field;
class JsonEditor extends Field
{
protected $view = 'admin.jsonEditor';
}
<?php
namespace App\Admin\Extensions\Form;
use Dcat\Admin\Form\Field;
class LeftDividerLabel extends Field
{
protected $view = 'admin.left_divider_label';
}
<?php
namespace App\Admin\Metrics\Examples;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Metrics\Donut;
class NewDevices extends Donut
{
protected $labels = ['Desktop', 'Mobile'];
/**
* 初始化卡片内容
*/
protected function init()
{
parent::init();
$color = Admin::color();
$colors = [$color->primary(), $color->alpha('blue2', 0.5)];
$this->title('New Devices');
$this->subTitle('Last 30 days');
$this->chartLabels($this->labels);
// 设置图表颜色
$this->chartColors($colors);
}
/**
* 渲染模板
*
* @return string
*/
public function render()
{
$this->fill();
return parent::render();
}
/**
* 写入数据.
*
* @return void
*/
public function fill()
{
$this->withContent(44.9, 28.6);
// 图表数据
$this->withChart([44.9, 28.6]);
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
return $this->chart([
'series' => $data
]);
}
/**
* 设置卡片头部内容.
*
* @param mixed $desktop
* @param mixed $mobile
*
* @return $this
*/
protected function withContent($desktop, $mobile)
{
$blue = Admin::color()->alpha('blue2', 0.5);
$style = 'margin-bottom: 8px';
$labelWidth = 120;
return $this->content(
<<<HTML
<div class="d-flex pl-1 pr-1 pt-1" style="{$style}">
<div style="width: {$labelWidth}px">
<i class="fa fa-circle text-primary"></i> {$this->labels[0]}
</div>
<div>{$desktop}</div>
</div>
<div class="d-flex pl-1 pr-1" style="{$style}">
<div style="width: {$labelWidth}px">
<i class="fa fa-circle" style="color: $blue"></i> {$this->labels[1]}
</div>
<div>{$mobile}</div>
</div>
HTML
);
}
}
<?php
namespace App\Admin\Metrics\Examples;
use Dcat\Admin\Widgets\Metrics\Line;
use Illuminate\Http\Request;
class NewUsers extends Line
{
/**
* 初始化卡片内容
*
* @return void
*/
protected function init()
{
parent::init();
$this->title('New Users');
$this->dropdown([
'7' => 'Last 7 Days',
'28' => 'Last 28 Days',
'30' => 'Last Month',
'365' => 'Last Year',
]);
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
$generator = function ($len, $min = 10, $max = 300) {
for ($i = 0; $i <= $len; $i++) {
yield mt_rand($min, $max);
}
};
switch ($request->get('option')) {
case '365':
// 卡片内容
$this->withContent(mt_rand(1000, 5000).'k');
// 图表数据
$this->withChart(collect($generator(30))->toArray());
break;
case '30':
// 卡片内容
$this->withContent(mt_rand(400, 1000).'k');
// 图表数据
$this->withChart(collect($generator(30))->toArray());
break;
case '28':
// 卡片内容
$this->withContent(mt_rand(400, 1000).'k');
// 图表数据
$this->withChart(collect($generator(28))->toArray());
break;
case '7':
default:
// 卡片内容
$this->withContent('89.2k');
// 图表数据
$this->withChart([28, 40, 36, 52, 38, 60, 55,]);
}
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
return $this->chart([
'series' => [
[
'name' => $this->title,
'data' => $data,
],
],
]);
}
/**
* 设置卡片内容.
*
* @param string $content
*
* @return $this
*/
public function withContent($content)
{
return $this->content(
<<<HTML
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
<h2 class="ml-1 font-lg-1">{$content}</h2>
<span class="mb-0 mr-1 text-80">{$this->title}</span>
</div>
HTML
);
}
}
<?php
namespace App\Admin\Metrics\Examples;
use Dcat\Admin\Widgets\Metrics\Round;
use Illuminate\Http\Request;
class ProductOrders extends Round
{
/**
* 初始化卡片内容
*/
protected function init()
{
parent::init();
$this->title('Product Orders');
$this->chartLabels(['Finished', 'Pending', 'Rejected']);
$this->dropdown([
'7' => 'Last 7 Days',
'28' => 'Last 28 Days',
'30' => 'Last Month',
'365' => 'Last Year',
]);
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
case '30':
case '28':
case '7':
default:
// 卡片内容
$this->withContent(23043, 14658, 4758);
// 图表数据
$this->withChart([70, 52, 26]);
// 总数
$this->chartTotal('Total', 344);
}
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
return $this->chart([
'series' => $data,
]);
}
/**
* 卡片内容.
*
* @param int $finished
* @param int $pending
* @param int $rejected
*
* @return $this
*/
public function withContent($finished, $pending, $rejected)
{
return $this->content(
<<<HTML
<div class="col-12 d-flex flex-column flex-wrap text-center" style="max-width: 220px">
<div class="chart-info d-flex justify-content-between mb-1 mt-2" >
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-primary"></i>
<span class="text-bold-600 ml-50">Finished</span>
</div>
<div class="product-result">
<span>{$finished}</span>
</div>
</div>
<div class="chart-info d-flex justify-content-between mb-1">
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-warning"></i>
<span class="text-bold-600 ml-50">Pending</span>
</div>
<div class="product-result">
<span>{$pending}</span>
</div>
</div>
<div class="chart-info d-flex justify-content-between mb-1">
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-danger"></i>
<span class="text-bold-600 ml-50">Rejected</span>
</div>
<div class="product-result">
<span>{$rejected}</span>
</div>
</div>
</div>
HTML
);
}
}
<?php
namespace App\Admin\Metrics\Examples;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Metrics\Bar;
use Illuminate\Http\Request;
class Sessions extends Bar
{
/**
* 初始化卡片内容
*/
protected function init()
{
parent::init();
$color = Admin::color();
$dark35 = $color->dark35();
// 卡片内容宽度
$this->contentWidth(5, 7);
// 标题
$this->title('Avg Sessions');
// 设置下拉选项
$this->dropdown([
'7' => 'Last 7 Days',
'28' => 'Last 28 Days',
'30' => 'Last Month',
'365' => 'Last Year',
]);
// 设置图表颜色
$this->chartColors([
$dark35,
$dark35,
$color->primary(),
$dark35,
$dark35,
$dark35
]);
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '7':
default:
// 卡片内容
$this->withContent('2.7k', '+5.2%');
// 图表数据
$this->withChart([
[
'name' => 'Sessions',
'data' => [75, 125, 225, 175, 125, 75, 25],
],
]);
}
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
return $this->chart([
'series' => $data,
]);
}
/**
* 设置卡片内容.
*
* @param string $title
* @param string $value
* @param string $style
*
* @return $this
*/
public function withContent($title, $value, $style = 'success')
{
// 根据选项显示
$label = strtolower(
$this->dropdown[request()->option] ?? 'last 7 days'
);
$minHeight = '183px';
return $this->content(
<<<HTML
<div class="d-flex p-1 flex-column justify-content-between" style="padding-top: 0;width: 100%;height: 100%;min-height: {$minHeight}">
<div class="text-left">
<h1 class="font-lg-2 mt-2 mb-0">{$title}</h1>
<h5 class="font-medium-2" style="margin-top: 10px;">
<span class="text-{$style}">{$value} </span>
<span>vs {$label}</span>
</h5>
</div>
<a href="#" class="btn btn-primary shadow waves-effect waves-light">View Details <i class="feather icon-chevrons-right"></i></a>
</div>
HTML
);
}
}
<?php
namespace App\Admin\Metrics\Examples;
use Dcat\Admin\Widgets\Metrics\RadialBar;
use Illuminate\Http\Request;
class Tickets extends RadialBar
{
/**
* 初始化卡片内容
*/
protected function init()
{
parent::init();
$this->title('Tickets');
$this->height(400);
$this->chartHeight(300);
$this->chartLabels('Completed Tickets');
$this->dropdown([
'7' => 'Last 7 Days',
'28' => 'Last 28 Days',
'30' => 'Last Month',
'365' => 'Last Year',
]);
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
case '30':
case '28':
case '7':
default:
// 卡片内容
$this->withContent(162);
// 卡片底部
$this->withFooter(29, 63, '1d');
// 图表数据
$this->withChart(83);
}
}
/**
* 设置图表数据.
*
* @param int $data
*
* @return $this
*/
public function withChart(int $data)
{
return $this->chart([
'series' => [$data],
]);
}
/**
* 卡片内容
*
* @param string $content
*
* @return $this
*/
public function withContent($content)
{
return $this->content(
<<<HTML
<div class="d-flex flex-column flex-wrap text-center">
<h1 class="font-lg-2 mt-2 mb-0">{$content}</h1>
<small>Tickets</small>
</div>
HTML
);
}
/**
* 卡片底部内容.
*
* @param string $new
* @param string $open
* @param string $response
*
* @return $this
*/
public function withFooter($new, $open, $response)
{
return $this->footer(
<<<HTML
<div class="d-flex justify-content-between p-1" style="padding-top: 0!important;">
<div class="text-center">
<p>New Tickets</p>
<span class="font-lg-1">{$new}</span>
</div>
<div class="text-center">
<p>Open Tickets</p>
<span class="font-lg-1">{$open}</span>
</div>
<div class="text-center">
<p>Response Time</p>
<span class="font-lg-1">{$response}</span>
</div>
</div>
HTML
);
}
}
<?php
namespace App\Admin\Metrics\Examples;
use Dcat\Admin\Widgets\Metrics\Card;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
class TotalUsers extends Card
{
/**
* 卡片底部内容.
*
* @var string|Renderable|\Closure
*/
protected $footer;
/**
* 初始化卡片.
*/
protected function init()
{
parent::init();
$this->title('Total Users');
$this->dropdown([
'7' => 'Last 7 Days',
'28' => 'Last 28 Days',
'30' => 'Last Month',
'365' => 'Last Year',
]);
}
/**
* 处理请求.
*
* @param Request $request
*
* @return void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
$this->content(mt_rand(600, 1500));
$this->down(mt_rand(1, 30));
break;
case '30':
$this->content(mt_rand(170, 250));
$this->up(mt_rand(12, 50));
break;
case '28':
$this->content(mt_rand(155, 200));
$this->up(mt_rand(5, 50));
break;
case '7':
default:
$this->content(143);
$this->up(15);
}
}
/**
* @param int $percent
*
* @return $this
*/
public function up($percent)
{
return $this->footer(
"<i class=\"feather icon-trending-up text-success\"></i> {$percent}% Increase"
);
}
/**
* @param int $percent
*
* @return $this
*/
public function down($percent)
{
return $this->footer(
"<i class=\"feather icon-trending-down text-danger\"></i> {$percent}% Decrease"
);
}
/**
* 设置卡片底部内容.
*
* @param string|Renderable|\Closure $footer
*
* @return $this
*/
public function footer($footer)
{
$this->footer = $footer;
return $this;
}
/**
* 渲染卡片内容.
*
* @return string
*/
public function renderContent()
{
$content = parent::renderContent();
return <<<HTML
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
<h2 class="ml-1 font-lg-1">{$content}</h2>
</div>
<div class="ml-1 mt-1 font-weight-bold text-80">
{$this->renderFooter()}
</div>
HTML;
}
/**
* 渲染卡片底部内容.
*
* @return string
*/
public function renderFooter()
{
return $this->toString($this->footer);
}
}
<?php
namespace App\Admin\Repositories;
use Dcat\Admin\Grid\Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Activity extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
\ No newline at end of file
<?php
namespace App\Admin\Repositories;
use App\Models\ActivityModule as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class ActivityModule extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
namespace App\Admin\Repositories;
use App\Models\ActivityStatistics as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class ActivityStatistics extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
namespace App\Admin\Repositories;
use App\Models\GiftActivity as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class GiftActivity extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
namespace App\Admin\Repositories;
use App\Models\Log as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Log extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
namespace App\Admin\Repositories;
use App\Models\MessageLog as Model;
use Dcat\Admin\Grid\Model as GridModel;
use Dcat\Admin\Repositories\EloquentRepository;
class MessageLog extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
public function get(GridModel $model)
{
$this->setSort($model);
$this->setPaginate($model);
$query = $this->newQuery();
if ($this->relations) {
$query->with($this->relations);
}
$result = $model->apply($query, true, $this->getGridColumns());
return $result;
}
}
\ No newline at end of file
<?php
namespace App\Admin\Repositories;
use App\Models\ModuleTemplet as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class ModuleTemplate extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
namespace App\Admin\Repositories;
use App\Models\PriceActivity as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class PriceActivity extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
namespace App\Admin\Repositories;
use App\User as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class User extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
namespace App\Admin\Repositories;
use App\Models\UserWrite as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class UserWrite extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
namespace App\Admin\RowActions;
use Dcat\Admin\Grid\RowAction;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;
class ClearActivityCache extends RowAction
{
/**
* 返回字段标题
*
* @return string
*/
public function title()
{
if ($this->row->has_cached == 1) {
return '<i title="删除缓存" style="margin-left: 10px" class="fa fa-ban"></i>';
}
}
public function confirm()
{
return [
// 确认弹窗 title
"您确定要清除该活动的缓存吗?",
// 确认弹窗 content
'活动名称 : ' . $this->row->name,
];
}
public function handle(Request $request)
{
// 获取当前行ID
$id = $this->getKey();
$result = Redis::del('Activity_' . $id);
if ($result !== false) {
return $this->response()->success("删除活动缓存成功!")->refresh();
} else {
return $this->response()->error("删除活动缓存失败,活动ID为 : " . $id)->refresh();
}
}
}
\ No newline at end of file
<?php
namespace App\Admin\RowActions;
use App\Models\Activity;
use App\Models\ActivityModule;
use Dcat\Admin\Actions\Response;
use Dcat\Admin\Grid\RowAction;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
class CopyActivity extends RowAction
{
protected $model;
public function __construct(string $model = null)
{
parent::__construct();
$this->model = $model;
}
/**
* 标题
*
* @return string
*/
public function title()
{
return '<i title="复制活动" class="fa fa-files-o"></i>';
}
/**
* 设置确认弹窗信息,如果返回空值,则不会弹出弹窗
*
* 允许返回字符串或数组类型
*
* @return array|string|void
*/
public function confirm()
{
return [
// 确认弹窗 title
"您确定要复制这个活动吗?",
// 确认弹窗 content
'活动名称 : ' . $this->row->name,
];
}
/**
* 处理请求
*
* @param Request $request
*
* @return Response
*/
public function handle(Request $request)
{
// 获取当前行ID
$id = $this->getKey();
$model = $request->get('model');
// 复制数据
if ($id) {
//获取对应的活动
$copyActivity = Activity::where('id', $id)->first()->toArray();
//先生成一个空活动获取id
$actId = Activity::insertGetId([
'sign' => 'copy_' . time(),
'type' => $copyActivity['type'],
'platform' => $copyActivity['platform'],
'add_time' => time(),
'start_time' => time(),
'admin_id' => $copyActivity['admin_id'],
'end_time' => time() + 3600 * 24 * 7,
]);
//获取被复制的活动的模块
$moduleList = ActivityModule::where('ac_id', $id)->get();
if ($moduleList) {
$moduleList = $moduleList->toArray();
$moduleData = [];
foreach ($moduleList as $key => $module) {
$detail = json_decode($module['detail'], true);
//将模块里面的东西全部制空
$detail = array_map(function () {
return '';
}, $detail);
$moduleData[] = [
'ac_id' => $actId,
'title' => $module['title'],
'add_time' => time(),
'detail' => json_encode($detail),
'templet_id' => $module['templet_id'],
];
}
ActivityModule::insert($moduleData);
}
}
// $model::find($id)->replicate()->save();
// 返回响应结果并刷新页面
return $this->response()->success("复制成功!")->refresh();
}
/**
* 设置要POST到接口的数据
*
* @return array
*/
public function parameters()
{
return [
// 发送当前行 username 字段数据到接口
'username' => $this->row->username,
// 把模型类名传递到接口
'model' => $this->model,
];
}
}
\ No newline at end of file
<?php
namespace App\Admin\RowActions;
use App\Models\Activity;
use App\Models\ActivityModule;
use Dcat\Admin\Actions\Response;
use Dcat\Admin\Grid\RowAction;
use Illuminate\Http\Request;
use Illuminate\Database\Eloquent\Model;
class PublishActivity extends RowAction
{
protected $model;
public function __construct(string $model = null)
{
parent::__construct();
$this->model = $model;
}
/**
* 标题
*
* @return string
*/
public function title()
{
if ($this->row->status == 1) {
return '<i title="发布活动" style="margin-left: 10px" class="fa fa-hand-paper-o"></i>';
} else {
return '';
}
}
/**
* 设置确认弹窗信息,如果返回空值,则不会弹出弹窗
*
* 允许返回字符串或数组类型
*
* @return array|string|void
*/
public function confirm()
{
return [
// 确认弹窗 title
"您确定要发布这个活动吗?",
// 确认弹窗 content
'活动名称 : ' . $this->row->name,
];
}
/**
* 处理请求
*
* @param Request $request
*
* @return Response
*/
public function handle(Request $request)
{
// 获取当前行ID
$id = $this->getKey();
$model = $request->get('model');
// 返回响应结果并刷新页面
return $this->response()->success("发布成功!")->refresh();
}
/**
* 设置要POST到接口的数据
*
* @return array
*/
public function parameters()
{
return [
// 发送当前行 username 字段数据到接口
'username' => $this->row->username,
// 把模型类名传递到接口
'model' => $this->model,
];
}
}
<?php
namespace App\Admin\Traits;
//根据权限系统生成菜单数据
class Menu
{
}
<?php
namespace App\Admin\Traits;
//上传相关的帮助组件
class Upload
{
//生成上传所需要的表单验证数据
//k1,k2
public function generateUploadKeys()
{
$data['k1'] = time();
$data['k2'] = MD5(MD5($data['k1']) . config('website.upload_key'));
return $data;
}
}
<?php
use App\Admin\Extensions\Form\JsonEditor;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\Column;
use Dcat\Admin\Grid\Filter;
use Dcat\Admin\Layout\Menu;
/**
* Dcat-admin - admin builder based on Laravel.
* @author jqh <https://github.com/jqhph>
*
* Bootstraper for Admin.
*
* Here you can remove builtin form field:
*
* extend custom field:
* Dcat\Admin\Form::extend('php', PHPEditor::class);
* Dcat\Admin\Grid\Column::extend('php', PHPEditor::class);
* Dcat\Admin\Grid\Filter::extend('php', PHPEditor::class);
*
* Or require js and css assets:
* Admin::css('/packages/prettydocs/css/styles.css');
* Admin::js('/packages/prettydocs/js/main.js');
*
*/
$primaryColor = '#009688';
Admin::style(
<<<CSS
body {
font-size: 13px;
}
[class*=sidebar-dark-] {
background-image: linear-gradient(0deg, #191A23, #191A23);
}
.nav-link {
color: #B7B7B3;
font-weight: 200;
font-size:14px!important;
}
.nav-item {
margin-top:3px;
margin-bottom:3px;
}
.nav-link.active {
background-color: $primaryColor!important;
}
body:not(.dark-mode) .table-collapse .custom-data-table tbody td {
height:30px;
}
body.dark-mode .table-collapse table.custom-data-table.data-table tbody td {
height:30px;
}
.form-group {
margin-bottom:5px;
}
.content-header {
display:none;
}
.datetime-range-fix {
}
/* .input-group {
max-height:30px;
} */
CSS
);
Column::extend('date', function ($value) {
return date('Y-m-d H:i:s', $value);
});
Column::extend('color', function ($value, $color) {
return "<span style='color: $color'>$value</span>";
});
Grid::resolving(function (Grid $grid) {
$grid->disableRowSelector();
// $grid->withBorder();
$grid->showQuickEditButton();
// $grid->enableDialogCreate();
// $grid->disableEditButton();
$grid->setDialogFormDimensions('80%', '99%');
// $grid->enableDialogCreate();
$grid->disableViewButton();
$grid->toolsWithOutline(false);
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
});
});
Form::resolving(function (Form $form) {
$form->disableEditingCheck();
$form->disableCreatingCheck();
$form->disableViewCheck();
$form->tools(function (Form\Tools $tools) {
$tools->disableDelete();
$tools->disableView();
});
});
Admin::menu(function (Menu $menu) {
//权限系统的菜单
$permMenus = request()->menus;
$permMenus = (array) $permMenus;
$addMenus = [];
foreach ($permMenus as $key => &$permMenu) {
$permMenu = (array) $permMenu;
//为了区分本系统手动添加的菜单
$key = $key + 1000;
$permMenu['id'] = $key + 1;
$permMenu['icon'] = $permMenu['class'];
$permMenu['uri'] = $permMenu['href'];
$permMenu['parent_id'] = 0;
$addMenus[] = $permMenu;
if (!empty($permMenu['childs'])) {
foreach ($permMenu['childs'] as $k => &$child) {
$child = (array) $child;
//为了让字菜单的id不和父菜单的id冲突
$child['id'] = $k + ($key + 1) * 100;
$child['parent_id'] = $key + 1;
$child['icon'] = $child['class'];
$child['uri'] = $child['href'];
$addMenus[] = $child;
}
}
}
unset($permMenu, $child);
$menu->add($addMenus);
});
Dcat\Admin\Color::extend('layui-green', [
'primary' => '#009688',
'primary-darker' => '#009688',
'link' => '#009688',
]);
//拓展表单组件
// 注册前端组件别名
Admin::asset()->alias('@jsonEditor', [
// 为了方便演示效果,这里直接加载CDN链接,实际开发中可以下载到服务器加载
'js' => ['/packages/jsoneditor/jsoneditor.min.js'],
'css' => ['/packages/jsoneditor/jsoneditor.min.css'],
]);
Form::extend('jsonEditor', JsonEditor::class);
<?php
use Dcat\Admin\Admin;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
Admin::routes();
Route::group([
'prefix' => config('admin.route.prefix'),
'namespace' => config('admin.route.namespace'),
'middleware' => config('admin.route.middleware'),
], function (Router $router) {
$router->any('upload', 'UploadController@upload');
$router->get('/', 'HomeController@index');
$router->get('/home', 'HomeController@index');
$router->resource('activities', 'ActivityController');
$router->get('web/speciallist', 'ActivityController@grid');
$router->resource('module_templates', 'ModuleTemplatesController');
$router->resource('logs', 'LogController');
$router->resource('user_write', 'UserWriteController');
$router->resource('message_logs', 'MessageLogController');
$router->resource('price_activity_statistics', 'PriceActivityStatisticsController');
$router->resource('gift_activity_statistics', 'GiftActivityStatisticsController');
});
<?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');
}
}
<?php
namespace App\Exceptions;
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 = [
'current_password',
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {
//
});
}
}
<?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;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
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 = '/home11';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}
<?php
namespace App\Http\Controllers\Auth;
use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
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 = '/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']),
]);
}
}
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
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 = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
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 = '/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');
}
}
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
<?php
namespace App\Http;
use App\Http\Middleware\CheckLogin;
use App\Http\Middleware\Menu;
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,
CheckLogin::class,
Menu::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',
'bindings',
],
];
/**
* 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,
'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\Session\Middleware\AuthenticateSession::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Illuminate\Auth\Middleware\Authorize::class,
];
}
<?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
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}
<?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 = [
//
];
}
<?php
namespace App\Http\Middleware;
use Closure;
class CheckLogin
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$userId = $request->cookie('oa_user_id');
$skey = $request->cookie('oa_skey');
$isApi = false;
$pos = strpos($request->path(), 'api/');
if ($pos === 0) {
$isApi = true;
}
$login = config('website.login');
if (!$userId || !$skey || (string)((int)$userId) != $userId || !preg_match('/^[a-zA-Z0-9]+$/', $skey)) {
if ($isApi) {
return ["errcode" => 401, "errmsg" => "没有登录"];
}
return redirect($login['login'] . '?redirect=' . urlencode($request->url()));
}
$cookie = 'oa_user_id=' . $userId . '; oa_skey=' . $skey;
$rsp = curl($login['check'], '', false, false, $cookie);
if (!$rsp) {
if ($isApi) {
return ['errcode' => 10001, 'errmsg' => '鉴权失败'];
}
abort(500);
}
$ret = json_decode($rsp);
if ($ret->retcode != 0) {
if ($isApi) {
return ["errcode" => $ret->retcode, "errmsg" => $ret->errMsg];
}
return redirect($login['login'] . '?redirect=' . urlencode($request->url()));
}
$user = $ret->data;
// $user->code = DB::connection()->table('lie_intracode')->where('admin_id',
// $user->userId)->select('code_id')->first();
$user->header = $request->cookie('oa_header');
$request->user = $user;
return $next($request);
}
}
<?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 = [
//
];
}
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Arr;
class Menu
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$isApi = $request->ajax();
$user = $request->user;
//处理权限和菜单
$permData = config('perm.perm');
$action = $request->route('key');
empty($action) && $action = 'Dashboard';
//获取菜单
if (!$isApi && empty($request->input('window'))) {
$menuData = json_decode(curl($permData['menu_url'] . $permData['menu_id']));
// $menuPerms = $this->getMenuPerms($menuData->data);
if (empty($menuData->data)) {
return '菜单生成错误,请联系技术';
} else {
$menuData = $menuData->data;
}
$menus = !in_array($request->user->userId, $permData['admin_group']) ?
$this->menu($menuData, $request->user->userId) : $menuData;
if (empty($menus)) {
return $this->view('Auth', '没有访问权限', $permData['go_url']);
}
$request->menus = $menus;
}
if (!in_array($user->userId, $permData['admin_group']) && $action != 'Dashboard') {//不是超级管理员
$perm = $this->perm($request->user->userId, $action);
if ($perm !== true) {
if ($isApi) {
return '没有权限';
}
return $this->view('Auth', '没有访问权限', $permData['go_url']);
}
}
return $next($request, $action);
}
//去菜单里面提取路由方法(用于权限对比)
private function getMenuPerms($menuData)
{
$perms = [];
foreach ($menuData as $k => $v) {
$v = (array)$v;
$permChild = [];
$perm = [];
if (strlen($v['href']) > 2) {
$action = explode('/', $v['href']);
$perm[] = end($action);
}
if (count($v['childs']) > 0) {
$permChild = $this->getMenuPerms($v['childs']);
}
$perms = array_merge($perms, array_merge($perm, $permChild));
}
return $perms;
}
//根据权限生成菜单
private function menu($menu, $user)
{
$perm = $this->getMenuPerms($menu);
$perm1 = implode(',', $perm);
$permArr = config('perm.perm');
$perm = $permArr['id'];
$url = $permArr['url'] . '/' . $user . '/' . $perm . '?perms=' . $perm1;
$result = json_decode(curl($url, '', false), true);
if ($result['retcode'] === 0) {
$find = $result['data']['perms'];
$menu = $this->deleteMenu($menu, $find);
if (!empty($menu) && is_array($menu)) {
foreach ($menu as $k => $v) {
$v = (array)$v;
if ($v['title'] != 'Dashboard' && count($v['childs']) == 0 && empty($v['href'])) {
unset($menu[$k]);
}
}
}
return array_merge($menu);
} else {
return false;
}
}
//删除没有权限的菜单
function deleteMenu($menu, $find)
{
foreach ($menu as $k => $v) {
if (strlen($v->href) > 2) {
$action = explode('/', $v->href);
$key = end($action);
if (empty($find[$key]) || $find[$key] == false) {
unset($menu[$k]);
}
} else {
if (count($v->childs) > 0) {
$menu[$k]->childs = array_values($this->deleteMenu($v->childs, $find));
}
if (!count($v->childs) > 0 && $v->title != '首页') {
unset($menu[$k]);
}//为了删除没有下级的目录
}
}
return array_values($menu);
}
private function view($errcode, $errinfo, $goUrl = '')
{
$data = [
'errcode' => $errcode,
'errinfo' => $errinfo,
'url' => $goUrl
];
return view('errors.error', $data);
}
//检查权限,仅支持验证单个权限
function perm($userId, $perm1 = '')
{
$permArr = config('perm.perm');
$NotAuth = $permArr['notAuth'];
$AdminID = $permArr['adminGroup'];
if ((!in_array($perm1, $NotAuth)) && !in_array($userId, $AdminID)) {//过滤不用鉴权的方法与用户
$permID = $permArr['id'];
$url = $permArr['url'] . '/' . $userId . '/' . $permID . '?perms=' . $perm1;
$result = json_decode(curl($url, '', 0), true);
if (!isset($result['retcode']) || $result['retcode'] !== 0 || $result['data']['perms'][$perm1] == false) {
return false;
} else {
return true;
}
} else {
return true;
}
}
}
<?php
namespace App\Http\Middleware;
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('/home');
}
return $next($request);
}
}
<?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',
];
}
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
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;
}
<?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 = [
//
];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Activity extends Model
{
protected $connection = 'special';
protected $table = 'activity';
public $timestamps = false;
public function modules()
{
return $this->hasMany(ActivityModule::class, 'ac_id', 'id');
}
public function user_info()
{
return $this->hasOne(UserInfo::class, 'userId', 'admin_id');
}
public function allActivity()
{
return;
}
}
<?php
namespace App\Models;
use App\Models\ModuleTemplet;
use Illuminate\Database\Eloquent\Model;
class ActivityModule extends Model
{
protected $connection = 'special';
protected $table = 'activity_module';
public $timestamps = false;
public function template()
{
return $this->hasOne(ModuleTemplet::class, 'id', 'templet_id');
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ActivityStatistics extends Model
{
protected $connection = 'special';
protected $table = 'activity_statistics';
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class AdminUsers extends Model
{
protected $connection = 'local';
use HasFactory;
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class GiftActivity extends Model
{
protected $connection = 'special';
protected $table = 'gift_activity';
public $timestamps = false;
public function statistics()
{
return $this->hasOne(ActivityStatistics::class, 'activity_id', 'id')->where('type', 2);
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Log extends Model
{
protected $connection = 'special';
protected $table = 'log';
public $timestamps = false;
}
\ No newline at end of file
<?php
namespace App\Models;
use App\Models\Activity;
use Illuminate\Database\Eloquent\Model;
class MessageLog extends Model
{
protected $connection = 'special';
protected $table = 'remind';
public $timestamps = false;
public function activity()
{
return $this->hasOne(Activity::class, 'id', 'ac_id');
}
}
\ No newline at end of file
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ModuleTemplet extends Model
{
protected $connection = 'special';
protected $table = 'module_templet';
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PriceActivity extends Model
{
protected $connection = 'special';
protected $table = 'price_activity';
public $timestamps = false;
public function statistics()
{
return $this->hasOne(ActivityStatistics::class, 'activity_id', 'id')->where('type', 1);
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class StaffRecords extends Model
{
// use HasFactory;
protected $connection = 'chemex';
protected $table = 'staff_records';
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class UserInfo extends Model
{
protected $connection = 'cms';
protected $table = 'user_info';
public $timestamps = false;
}
\ No newline at end of file
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class UserWrite extends Model
{
protected $connection = 'special';
protected $table = 'user_write';
public $timestamps = false;
public function activity()
{
return $this->hasOne(Activity::class, 'id', 'activity_id');
}
}
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
if ($this->app->isLocal()) {
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
}
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
}
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
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();
//
}
}
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Broadcast;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
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();
//
}
}
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
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';
/**
* 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'));
}
}
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
/**
* App\User
*
* @property int $id
* @property string $name
* @property string $email
* @property \Illuminate\Support\Carbon|null $email_verified_at
* @property string $password
* @property string|null $remember_token
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
* @property-read int|null $notifications_count
* @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|User newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|User query()
* @method static \Illuminate\Database\Eloquent\Builder|User whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereEmail($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereEmailVerifiedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|User wherePassword($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereRememberToken($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereUpdatedAt($value)
* @mixin \Eloquent
*/
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',
];
}
<?php
function curl($url, $params = false, $ispost = 0, $https = 0, $cookie = '', $timeout = 1000)
{
$httpInfo = array();
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_USERAGENT,
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_REFERER, Config('website.data'));
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 对认证证书来源的检查
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // 从证书中检查SSL加密算法是否存在
$header_str = "Referer:footstone.ichunt.net";
$header[] = $header_str;
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
if ($ispost) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_URL, $url);
} else {
if ($params) {
if (is_array($params)) {
$params = http_build_query($params);
}
curl_setopt($ch, CURLOPT_URL, $url . '?' . $params);
} else {
curl_setopt($ch, CURLOPT_URL, $url);
}
}
$response = curl_exec($ch);
if ($response === false) {
echo "cURL Error: " . curl_error($ch);
return false;
}
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$httpInfo = array_merge($httpInfo, curl_getinfo($ch));
curl_close($ch);
return $response;
}
#!/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);
<?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;
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.1.3",
"ext-json": "*",
"dcat/laravel-admin": "2.1.5-beta",
"dcat/laravel-wherehasin": "^0.6.0",
"doctrine/dbal": "^3.1",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.0",
"laravel/tinker": "^2.6",
"laravel/ui": "^3.3",
"mews/purifier": "^3.3",
"mosiboom/dcat-iframe-tab": "^1.2",
"predis/predis": "^1.1"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.9",
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"platform-check": false
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
],
"files": [
"app/helpers.php"
]
},
"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"
]
},
"repositories": {
"packagist": {
"type": "composer",
"url": "https://mirrors.aliyun.com/composer/"
}
}
}
This diff could not be displayed because it is too large.
<?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' => 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' => 'UTC',
/*
|--------------------------------------------------------------------------
| 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,
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::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,
],
];
<?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,
],
],
];
<?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',
],
],
];
<?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'),
];
<?php
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'),
]) : [],
],
'local' => [
'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'),
]) : [],
],
'chemex' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_CHEMEX_HOST', '127.0.0.1'),
'port' => env('DB_CHEMEX_PORT', '3306'),
'database' => env('DB_CHEMEX_DATABASE', 'forge'),
'username' => env('DB_CHEMEX_USERNAME', 'forge'),
'password' => env('DB_CHEMEX_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'),
]) : [],
],
'special' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_SPECIAL_HOST', '127.0.0.1'),
'port' => env('DB_SPECIAL_PORT', '3306'),
'database' => env('DB_SPECIAL_DATABASE', 'forge'),
'username' => env('DB_SPECIAL_USERNAME', 'forge'),
'password' => env('DB_SPECIAL_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'lie_',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'www' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_WWW_HOST', '127.0.0.1'),
'port' => env('DB_WWW_PORT', '3306'),
'database' => env('DB_WWW_DATABASE', 'forge'),
'username' => env('DB_WWW_USERNAME', 'forge'),
'password' => env('DB_WWW_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'lie_',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'cms' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_CMS_HOST', '127.0.0.1'),
'port' => env('DB_CMS_PORT', '3306'),
'database' => env('DB_CMS_DATABASE', 'forge'),
'username' => env('DB_CMS_USERNAME', 'forge'),
'password' => env('DB_CMS_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8',
'collation' => 'utf8_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', 'predis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'predis'),
// '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),
'read_write_timeout' => 60,
'prefix' => '',
],
'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),
],
],
];
<?php
return [
'activity_type' => [
1 => '专题活动',
2 => '促销活动',
3 => '邀请有礼活动',
4 => '抽奖活动',
5 => '拉新活动',
0 => '其它活动',
],
'status' => [
1 => '未上线',
2 => '已上线',
3 => '已删除',
],
'new_activity_status' => [
1 => '已发布',
0 => '未发布',
-1 => '已删除',
],
'activity_platform' => [
1 => 'PC&H5',
2 => 'PC',
3 => 'H5',
],
'page_modules' => [
'左侧客服浮动' => '左侧客服浮动',
'下册注册浮层' => '下册注册浮层',
'右侧快捷入口' => '右侧快捷入口',
],
'log_type' => [
1 => '创建',
2 => '修改',
3 => '删除',
4 => '其他',
5 => '启用',
6 => '禁用',
7 => '发布上线',
],
'log_activity_type' => [
'activity' => '魔方活动',
'activity_module' => '活动模板',
'module_templet' => '模板配置',
'goods_limit' => '限时限量活动',
'activity_price' => '活动价',
'activity_price_user' => '会员价',
],
//'1:待提醒 2:已提醒 3:异常4:停止推送',
'message_remind_status' => [
1 => '待提醒',
2 => '已提醒',
3 => '异常',
4 => '停止推送',
],
];
<?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", "rackspace"
|
*/
'disks' => [
'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'),
],
],
];
<?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,
],
];
<?php
return [
# 是否开启iframe_tab
'enable' => env('START_IFRAME_TAB', false),
# 底部设置
'footer_setting' => [
'copyright' => env('APP_NAME', ''),
'app_version' => env('APP_VERSION', ''),
# 是否将底部置于菜单下
'use_menu' => false,
],
# 是否开启标签页缓存
'cache' => env('IFRAME_TAB_CACHE', false),
# 更改dialog表单默认宽高
'dialog_area_width' => env('IFRAME_TAB_DIALOG_AREA_WIDTH', '50%'),
'dialog_area_height' => env('IFRAME_TAB_DIALOG_AREA_HEIGHT', '90vh'),
# iframe-tab占用的路由 默认 '/'
'router' => '/',
# iframe-tab域名(一般用于多应用后台)
'domain' => null,
# 是否开启懒加载模式
'lazy_load' => true,
];
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
No preview for this file type
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment