Commit 74024957 by lizhilin

更新

parents
/node_modules
/public
/vendor
.env
.env.backup
.env.production
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode
<?php
namespace App\Admin\Controllers;
use Dcat\Admin\Http\Controllers\AuthController as BaseAuthController;
class AuthController extends BaseAuthController
{
protected $view = 'admin.login';
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\Covenant;
use App\Models\Covenant as ModelsCovenant;
use App\Models\Lawyer as ModelLawyer;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class CovenantController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(ModelsCovenant::with(['principal', 'lawyer']), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('number');
$grid->column('cname');
$grid->column('ctype')->display(function ($val) {
return Covenant::CTYPE[$val];
});
$grid->column('sign_at');
$grid->column('principal.name', '委托人');
$grid->column('lawyer.name', '办案律师');
$grid->column('amount');
$grid->column('payment_method')->display(function ($val) {
return $val == 1 ? '开票付款' : '付款开票';
});
$grid->column('reserve_fee', '预留结案费');
$grid->column('is_closed', '结案状态')->display(function ($val) {
return $val ? '已结案' : '未结案';
});
$grid->column('is_return', '退还状态')->display(function ($val) {
return $val ? '已退还' : '未退还';
});
$grid->column('return_fee', '退还结案费');
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid->disableViewButton();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('number')->width(3);
$filter->like('cname')->width(3);
$filter->like('principal.name', '委托人')->width(3);
$filter->like('lawyer.name', '办案律师')->width(3);
$filter->equal('ctype')->select(Covenant::CTYPE)->width(3);
$filter->equal('payment_method')->select(Covenant::PAYMENT_METHOD)->width(3);
$filter->between('sign_at', '签约日期')->date()->width(4);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Covenant(), function (Show $show) {
$show->field('id');
$show->field('number');
$show->field('cname');
$show->field('ctype');
$show->field('sign_at');
$show->field('principal_id');
$show->field('lawyer_id');
$show->field('amount');
$show->field('payment_method');
$show->field('case_reason');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$list = ModelLawyer::select(['id', 'number', 'name'])->limit(1000)->get()->toArray();
$lawyers = [];
if ($list) {
foreach ($list as $item) {
$lawyers[$item['id']] = $item['number'] . ' ' . $item['name'];
}
}
return Form::make(new Covenant(), function (Form $form) use ($lawyers) {
$form->display('id');
$form->text('number')->required();
$form->select('ctype')->options(Covenant::CTYPE)->default(1);
$form->text('cname')->required();
$form->date('sign_at')->format('YYYY-MM-DD')->default(date("Y-m-d"));
$form->select('principal_type')->options([1 => '单位', 2 => '个人'])->default(1)->load('principal_id', '/principal-list');;
$form->select('principal_id');
$form->text('case_reason');
$form->select('lawyer_id')->options($lawyers);
$form->text('amount');
$form->select('payment_method')->options(Covenant::PAYMENT_METHOD)->default(1);
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?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());
// });
$row->column(12, '欢迎登录');
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\Lawyer;
use App\Models\Lawyer as ModelLawyer;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
use Illuminate\Support\Facades\DB;
class LawyerController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Lawyer(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('number');
$grid->column('name');
$grid->column('sex')->display(function ($val) {
return $val == 1 ? '男' : '女';
});
$grid->column('identity_card');
$grid->column('phone');
$grid->column('bank_account');
$grid->column('sign_at');
$grid->column('commission_rate');
$grid->column('settlement_period')->display(function ($val) {
return $val == 1 ? '月' : '年';
});
$grid->column('ticket_ratio', '贴票比例(%)');
$grid->column('settlement_method', '结算方式')->display(function ($val) {
return $val == 1 ? '贴票' : '个税';
});
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid->disableViewButton();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('name')->width(3);
$filter->like('identity_card')->width(3);
$filter->like('phone')->width(3);
$filter->equal('settlement_period')->select(Lawyer::SETTLEMENT_PERIOD)->width(3);
$filter->equal('settlement_method')->select(Lawyer::SETTLEMENT_METHOD)->width(3);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Lawyer(), function (Show $show) {
$show->field('id');
$show->field('number');
$show->field('name');
$show->field('sex');
$show->field('identity_card');
$show->field('phone');
$show->field('bank_account');
$show->field('sign_at');
$show->field('commission_rate');
$show->field('settlement_period');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = Form::make(new Lawyer(), function (Form $form) {
$form->display('id');
//$form->text('number');
$form->text('name')->required();
$form->select('sex')->options([1 => '男', 2 => '女'])->default(1);
$form->text('identity_card')->required();
$form->text('phone')->required();
$form->text('bank_account')->required();
$form->date('sign_at')->format('YYYY-MM-DD')->required();
$form->text('commission_rate')->required();
$form->select('settlement_period')->options([1 => '月', 2 => '年'])->default(1);
$form->text('ticket_ratio', '贴票比例')->required();
$form->select('settlement_method', '结算方式')->options([1 => '贴票', 2 => '个税'])->default(1);
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
$number = $form->number;
$form->hidden('number');
if (!$number) {
$form->saving(function (Form $form) {
$form->number = self::getRandNumber();
});
}
// $form->display('created_at');
// $form->display('updated_at');
});
return $form;
}
//生成编号
public static function getRandNumber()
{
$rndnumber = '';
$flag = 0;
do {
$rndnumber = mt_rand(10000, 99999);
$rowObj = ModelLawyer::where('number', $rndnumber)->count();
$flag = $rowObj ? 0 : 1;
} while ($flag < 1);
return $rndnumber;
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\LawyerCost as ModelLawyerCost;
use App\Admin\Repositories\LawyerCost;
use App\Models\Lawyer as ModelsLawyer;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class LawyerCostCollectController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new LawyerCost(), function (Grid $grid) {
$number = $grid->model()->filter()->input('no') ?? ''; //律师编号
$nowyear = date("Y");
$year = $grid->model()->filter()->input('year') ?? '';
$monthNum = ($year && $year < $nowyear) ? 12 : date('m');
// $where = [];
// if ($number) {
// $where['number'] = $number;
// }
// if ($year) {
// $where['year'] = $year;
// }
// $grid->model()->where($where);
$grid->column('title', '项目名称')->width('10%');
for ($i = 1; $i <= $monthNum; $i++) {
$grid->column($i, $i . '月');
}
$grid->column('total', '合计');
// $grid->disableViewButton();
// $grid->disableCreateButton();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('year', '年份')->width(3)->default(date("Y"));
});
$grid->disableRowSelector();
$grid->disableActions();
$grid->disableCreateButton();
$grid->disablePagination();
//文字信息
$grid->tools(function (Grid\Tools $tools) use ($grid, $number) {
$fullname = '';
if ($number) {
$obj = ModelsLawyer::where('number', $number)->first();
$fullname = $obj->name;
}
$card_info = "&nbsp;&nbsp;律师编号:{$number}&nbsp;&nbsp;&nbsp;律师姓名:{$fullname}";
$tools->append($card_info);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new ModelLawyerCost(), function (Show $show) {
$show->field('id');
$show->field('year');
$show->field('month');
$show->field('number');
$show->field('lname');
$show->field('basic_salary');
$show->field('social_person_fee');
$show->field('social_company_fee');
$show->field('accumulation_fund_person_fee');
$show->field('accumulation_fund_company_fee');
$show->field('annual_inspection_fee');
$show->field('annuity');
$show->field('office_rental_fee');
$show->field('noticket_cost');
$show->field('posting_tickets_fee');
$show->field('assistant_fee');
$show->field('special_additional');
$show->field('advance_fee');
$show->field('personal_income_tax');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new ModelLawyerCost(), function (Form $form) {
$form->display('id');
$form->text('year');
$form->select('month')->options(ModelLawyerCost::MONTH);
$form->display('number');
$form->text('lname');
$form->text('basic_salary');
$form->text('social_person_fee');
$form->text('social_company_fee');
//$form->display('social', '社保')->default(100);
$form->text('accumulation_fund_person_fee');
$form->text('accumulation_fund_company_fee');
$form->text('annual_inspection_fee');
$form->text('annuity');
$form->text('office_rental_fee');
//$form->text('noticket_cost');
//$form->text('posting_tickets_fee');
$form->text('assistant_fee');
$form->text('special_additional');
$form->text('advance_fee');
$form->text('personal_income_tax');
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Controllers;
//use App\Admin\Repositories\LawyerCost;
use App\Admin\Repositories\Lawyer;
use App\Models\LawyerCost as ModelLawyerCost;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class LawyerCostController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Lawyer(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('number', '律师编号');
$grid->column('name', '律师姓名');
$grid->column('basic_salary', '基本工资');
$grid->column('special_additional', '专项附加');
$grid->column('social', '社保');
$grid->column('accumulation_fund', '公积金');
$grid->column('annual_inspection_fee', '律所年检费');
$grid->column('annuity', '律所年金');
$grid->column('posting_tickets_fee', '贴票成本');
$grid->column('assistant_fee', '助理律师成本');
$grid->column('office_rental_fee', '办公租赁成本');
$grid->column('noticket_cost', '无票成本');
$grid->column('personal_income_tax', '个人所得税');
$grid->disableViewButton();
$grid->disableEditButton();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('number', '律师编号')->width(3);
$filter->like('name', '律师姓名')->width(3);
$filter->like('year', '年份')->width(3)->default(date("Y"));
//$filter->date('sign_at')->format('YYYY-MM-DD');
});
$grid->actions(function (Grid\Displayers\Actions $actions) {
//$actions->append(new UserBuyCode($actions->row->id));
//成本汇总
$actions->append('<a href="/lycost-collect?no=' . $this->number . '" alt="成本汇总" target="_blank">成本汇总</a>');
// 成本明细
$actions->append('<a href="/lycost-list?no=' . $this->number . '" alt="成本明细" target="_blank">成本明细</a>');
// 或者使用 RowAction 来添加按钮
//$actions->append(RowAction::make('自定义按钮')->route('custom.route'));
});
});
}
protected function grid2()
{
return Grid::make(new ModelLawyerCost(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('year');
$grid->column('month');
$grid->column('number');
$grid->column('lname');
$grid->column('basic_salary');
$grid->column('social_person_fee');
$grid->column('social_company_fee');
$grid->column('accumulation_fund_person_fee');
$grid->column('accumulation_fund_company_fee');
$grid->column('annual_inspection_fee');
$grid->column('annuity');
$grid->column('office_rental_fee');
$grid->column('noticket_cost');
$grid->column('posting_tickets_fee');
$grid->column('assistant_fee');
$grid->column('special_additional');
$grid->column('advance_fee');
$grid->column('personal_income_tax');
$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 ModelLawyerCost(), function (Show $show) {
$show->field('id');
$show->field('year');
$show->field('month');
$show->field('number');
$show->field('lname');
$show->field('basic_salary');
$show->field('social_person_fee');
$show->field('social_company_fee');
$show->field('accumulation_fund_person_fee');
$show->field('accumulation_fund_company_fee');
$show->field('annual_inspection_fee');
$show->field('annuity');
$show->field('office_rental_fee');
$show->field('noticket_cost');
$show->field('posting_tickets_fee');
$show->field('assistant_fee');
$show->field('special_additional');
$show->field('advance_fee');
$show->field('personal_income_tax');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new ModelLawyerCost(), function (Form $form) {
$form->display('id');
$form->text('year');
$form->select('month')->options(ModelLawyerCost::MONTH);
$form->text('number');
$form->text('lname');
$form->text('basic_salary');
$form->text('social_person_fee');
$form->text('social_company_fee');
//$form->display('social', '社保')->default(100);
$form->text('accumulation_fund_person_fee');
$form->text('accumulation_fund_company_fee');
$form->text('annual_inspection_fee');
$form->text('annuity');
$form->text('office_rental_fee');
//$form->text('noticket_cost');
//$form->text('posting_tickets_fee');
$form->text('assistant_fee');
$form->text('special_additional');
$form->text('advance_fee');
$form->text('personal_income_tax');
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\LawyerCost as ModelLawyerCost;
use App\Admin\Repositories\Lawyer;
use App\Models\Lawyer as ModelsLawyer;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class LawyerCostListController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new ModelLawyerCost(), function (Grid $grid) {
$number = $grid->model()->filter()->input('no') ?? ''; //律师编号
$year = $grid->model()->filter()->input('year') ?? '';
$where = [];
if ($number) {
$where['number'] = $number;
}
if ($year) {
$where['year'] = $year;
}
$grid->model()->where($where);
$grid->column('id')->sortable();
$grid->column('year', '年份');
$grid->column('month', '月份');
$grid->column('basic_salary', '基本工资');
$grid->column('special_additional', '专项附加');
$grid->column('social', '社保');
$grid->column('social_person_fee', '社保个人部分');
$grid->column('social_company_fee', '社保公司部分');
$grid->column('accumulation_fund', '公积金');
$grid->column('accumulation_fund_person_fee', '公积金个人部分');
$grid->column('accumulation_fund_company_fee', '公积金公司部分');
$grid->column('annual_inspection_fee', '律所年检费');
$grid->column('annuity', '律所年金');
$grid->column('posting_tickets_fee', '贴票成本');
$grid->column('assistant_fee', '助理律师成本');
$grid->column('office_rental_fee', '办公租赁成本');
$grid->column('noticket_cost', '无票成本');
$grid->column('personal_income_tax', '个人所得税');
$grid->column('advance_fee', '预支款');
$grid->disableViewButton();
$grid->disableCreateButton();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('year', '年份')->width(3)->default(date("Y"));
});
//文字信息
$grid->tools(function (Grid\Tools $tools) use ($grid, $number) {
$fullname = '';
if ($number) {
$obj = ModelsLawyer::where('number', $number)->first();
$fullname = $obj->name;
}
$card_info = "&nbsp;&nbsp;律师编号:{$number}&nbsp;&nbsp;&nbsp;律师姓名:{$fullname}";
$tools->append($card_info);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new ModelLawyerCost(), function (Show $show) {
$show->field('id');
$show->field('year');
$show->field('month');
$show->field('number');
$show->field('lname');
$show->field('basic_salary');
$show->field('social_person_fee');
$show->field('social_company_fee');
$show->field('accumulation_fund_person_fee');
$show->field('accumulation_fund_company_fee');
$show->field('annual_inspection_fee');
$show->field('annuity');
$show->field('office_rental_fee');
$show->field('noticket_cost');
$show->field('posting_tickets_fee');
$show->field('assistant_fee');
$show->field('special_additional');
$show->field('advance_fee');
$show->field('personal_income_tax');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new ModelLawyerCost(), function (Form $form) {
$form->display('id');
$form->text('year');
$form->select('month')->options(ModelLawyerCost::MONTH);
$form->display('number');
$form->text('lname');
$form->text('basic_salary');
$form->text('social_person_fee');
$form->text('social_company_fee');
//$form->display('social', '社保')->default(100);
$form->text('accumulation_fund_person_fee');
$form->text('accumulation_fund_company_fee');
$form->text('annual_inspection_fee');
$form->text('annuity');
$form->text('office_rental_fee');
//$form->text('noticket_cost');
//$form->text('posting_tickets_fee');
$form->text('assistant_fee');
$form->text('special_additional');
$form->text('advance_fee');
$form->text('personal_income_tax');
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\Covenant;
use App\Models\Covenant as ModelsCovenant;
use App\Models\Lawyer as ModelLawyer;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class LawyerCovenantIncomeController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(ModelsCovenant::with(['principal', 'lawyer']), function (Grid $grid) {
$number = $grid->model()->filter()->input('no') ?? ''; //律师编号
if ($number) {
$grid->model()->where('number', $number);
}
$grid->column('id')->sortable();
$grid->column('number');
$grid->column('cname');
$grid->column('ctype')->display(function ($val) {
return Covenant::CTYPE[$val];
});
$grid->column('sign_at');
$grid->column('principal.name', '委托人');
$grid->column('lawyer.name', '办案律师');
$grid->column('amount');
$grid->column('payment_method')->display(function ($val) {
return $val == 1 ? '开票付款' : '付款开票';
});
$grid->column('reserve_fee', '预留结案费');
$grid->column('is_closed', '结案状态')->display(function ($val) {
return $val ? '已结案' : '未结案';
});
$grid->column('is_return', '退还状态')->display(function ($val) {
return $val ? '已退还' : '未退还';
});
$grid->column('return_fee', '退还结案费');
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid->disableViewButton();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('number')->width(3);
$filter->like('cname')->width(3);
$filter->like('principal.name', '委托人')->width(3);
$filter->like('lawyer.name', '办案律师')->width(3);
$filter->equal('ctype')->select(Covenant::CTYPE)->width(3);
$filter->equal('payment_method')->select(Covenant::PAYMENT_METHOD)->width(3);
$filter->between('sign_at', '签约日期')->date()->width(4);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Covenant(), function (Show $show) {
$show->field('id');
$show->field('number');
$show->field('cname');
$show->field('ctype');
$show->field('sign_at');
$show->field('principal_id');
$show->field('lawyer_id');
$show->field('amount');
$show->field('payment_method');
$show->field('case_reason');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$list = ModelLawyer::select(['id', 'number', 'name'])->limit(1000)->get()->toArray();
$lawyers = [];
if ($list) {
foreach ($list as $item) {
$lawyers[$item['id']] = $item['number'] . ' ' . $item['name'];
}
}
return Form::make(new Covenant(), function (Form $form) use ($lawyers) {
$form->display('id');
$form->text('number')->required();
$form->select('ctype')->options(Covenant::CTYPE)->default(1);
$form->text('cname')->required();
$form->date('sign_at')->format('YYYY-MM-DD')->default(date("Y-m-d"));
$form->select('principal_type')->options([1 => '单位', 2 => '个人'])->default(1)->load('principal_id', '/principal-list');;
$form->select('principal_id');
$form->text('case_reason');
$form->select('lawyer_id')->options($lawyers);
$form->text('amount');
$form->select('payment_method')->options(Covenant::PAYMENT_METHOD)->default(1);
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Controllers;
//use App\Admin\Repositories\LawyerCost;
use App\Models\Lawyer as ModelLawyer;
use App\Models\LawyerCost as ModelLawyerCost;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class LawyerIncomeController extends AdminController
{
/**
* 律师创收信息
* Make a grid builder.
* @return Grid
*/
protected function grid()
{
return Grid::make(new ModelLawyer(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('number', '律师编号111');
$grid->column('name', '律师姓名');
$grid->column('sex', '性别');
$grid->column('identity_card', '身份证号');
$grid->column('field1', '开票金额');
$grid->column('field2', '已收款');
$grid->column('field3', '已收款未开票');
$grid->column('field4', '已开票未收款')->display(function () {
$linkstr = '<a href="/lawyer-covenant-income?no="' . $this->number . ' target="_blank">创收收款表</a>&nbsp;&nbsp;';
$linkstr .= '<a href="http://baidu.com?no="' . $this->number . ' target="_blank">已收款/已开票汇总</a><br/>';
return $linkstr;
});
$grid->disableViewButton();
$grid->disableEditButton();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('number', '律师编号')->width(3);
$filter->like('name', '律师姓名')->width(3);
$filter->like('year', '年份')->width(3)->default(date("Y"));
//$filter->date('sign_at')->format('YYYY-MM-DD');
});
$grid->actions(function (Grid\Displayers\Actions $actions) {
//$actions->append(new UserBuyCode($actions->row->id));
//成本汇总
$actions->append('<a href="/lycost-collect?no=' . $this->number . '" alt="成本汇总" target="_blank">成本汇总</a>');
// 成本明细
$actions->append('<a href="/lycost-list?no=' . $this->number . '" alt="成本明细" target="_blank">成本明细</a>');
// 或者使用 RowAction 来添加按钮
//$actions->append(RowAction::make('自定义按钮')->route('custom.route'));
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new ModelLawyerCost(), function (Show $show) {
$show->field('id');
$show->field('year');
$show->field('month');
$show->field('number');
$show->field('lname');
$show->field('basic_salary');
$show->field('social_person_fee');
$show->field('social_company_fee');
$show->field('accumulation_fund_person_fee');
$show->field('accumulation_fund_company_fee');
$show->field('annual_inspection_fee');
$show->field('annuity');
$show->field('office_rental_fee');
$show->field('noticket_cost');
$show->field('posting_tickets_fee');
$show->field('assistant_fee');
$show->field('special_additional');
$show->field('advance_fee');
$show->field('personal_income_tax');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new ModelLawyerCost(), function (Form $form) {
$form->display('id');
$form->text('year');
$form->select('month')->options(ModelLawyerCost::MONTH);
$form->text('number');
$form->text('lname');
$form->text('basic_salary');
$form->text('social_person_fee');
$form->text('social_company_fee');
//$form->display('social', '社保')->default(100);
$form->text('accumulation_fund_person_fee');
$form->text('accumulation_fund_company_fee');
$form->text('annual_inspection_fee');
$form->text('annuity');
$form->text('office_rental_fee');
//$form->text('noticket_cost');
//$form->text('posting_tickets_fee');
$form->text('assistant_fee');
$form->text('special_additional');
$form->text('advance_fee');
$form->text('personal_income_tax');
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\Principal;
use App\Models\Principal as ModelsPrincipal;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class PrincipalController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Principal(), function (Grid $grid) {
$ptype = $grid->model()->filter()->input('wtype') ?? 1;
$grid->model()->where('wtype', $ptype)->orderBy("id", "desc");
$grid->column('id')->sortable();
$grid->column('number');
if ($ptype == 1) {
$grid->column('company');
$grid->column('tax_number');
$grid->column('address');
$grid->column('tel');
$grid->column('bank_name');
$grid->column('bank_account');
$grid->column('contacts');
} else {
$grid->column('name');
$grid->column('identity_card');
$grid->column('address', '联系地址');
}
$grid->column('phone');
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid->disableViewButton();
$grid->filter(function (Grid\Filter $filter) use ($ptype) {
// 更改为 panel 布局
$filter->panel();
$filter->like('company')->width(3);
$filter->like('tax_number')->width(3);
$filter->like('name')->width(3);
$filter->like('identity_card')->width(3);
$filter->equal('wtype', '类型')->select([1 => '单位', 2 => '个人'])->width(3)->default(1);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Principal(), function (Show $show) {
$show->field('id');
$show->field('number');
$show->field('company');
$show->field('username');
$show->field('identity_card');
$show->field('tax_number');
$show->field('address');
$show->field('tel');
$show->field('bank_name');
$show->field('bank_account');
$show->field('contacts');
$show->field('phone');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = Form::make(new Principal(), function (Form $form) {
$form->display('id');
$form->radio('wtype', '类型')
->when(1, function (Form $form) {
$form->text('company');
$form->text('tax_number');
$form->text('address');
$form->text('tel');
$form->text('bank_name');
$form->text('bank_account');
$form->text('contacts');
})
->when(2, function (Form $form) {
$form->text('name');
$form->text('identity_card');
$form->text('address', '联系地址');
})
->options([
1 => '单位',
2 => '个人',
])
->default(1);
$form->text('phone');
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
$number = $form->number;
$form->hidden('number');
if (!$number) {
$form->saving(function (Form $form) {
$form->number = self::getRandNumber();
});
}
$form->display('created_at');
$form->display('updated_at');
});
return $form;
}
//生成编号
public static function getRandNumber()
{
$rndnumber = '';
$flag = 0;
do {
$rndnumber = mt_rand(10000, 99999);
$rowObj = ModelsPrincipal::where('number', $rndnumber)->count();
$flag = $rowObj ? 0 : 1;
} while ($flag < 1);
return $rndnumber;
}
public function getList(Request $request)
{
$wtype = $request->get('q'); //委托人类型
if ($wtype == 1) {
$list = ModelsPrincipal::where('wtype', $wtype)->limit(1000)->get(['id', 'company as text']);
} else {
$list = ModelsPrincipal::where('wtype', $wtype)->limit(1000)->get(['id', 'name as text']);
}
return $list->toArray() ? $list : new \stdClass;;
}
}
<?php
namespace App\Admin\Controllers;
use App\Handlers\AilOss;
use Dcat\Admin\Traits\HasUploadedFile;
use Intervention\Image\Facades\Image;
class UploadController{
use HasUploadedFile;
/**
* 删除OSS私有桶资源文件
*/
public function deleteOssFile(){
$ossPath = request()->post('key') ?? '';
$aliOss = new AilOss();
$res = $aliOss->delete($ossPath);
return $res ? $this->responseDeleted() : $this->responseDeleteFailed('文件删除失败');
}
/**
* 删除OSS公有桶资源文件
*/
public function deletePublicOssFile(){
$ossPath = request()->post('key') ?? '';
$aliOss = new AilOss();
$res = $aliOss->delete($ossPath,'OSS_PUBLIC_BUCKET');
return $res ? $this->responseDeleted() : $this->responseDeleteFailed('文件删除失败');
}
/**
* 上传用户头像
*/
public function uploadUserAvatar()
{
$aliOss = new AilOss();
// 获取上传的文件
$file = $this->file();;
//获取文件扩展名
$file = $this->file();;
Image::make($file->getRealPath())
->resize(640, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode('jpg', 90);
$fileName = md5(uniqid()) . '.jpg';
$date = date('Y_m_d');
$ossFilePath = 'userAvatar/'.$date.'/'.$fileName;
//获取文件的绝对路径
$path = $file->getRealPath();
$res = $aliOss->upload($ossFilePath, $path,'OSS_PUBLIC_BUCKET');
return $res
? $this->responseUploaded(env('OSS_PUBLIC_IMAGE_URL').$ossFilePath,'')
: $this->responseErrorMessage('文件上传失败');
}
/**
* 上传轮播图
*/
public function uploadCarousel()
{
$aliOss = new AilOss();
// 获取上传的文件
$file = $this->file();;
Image::make($file->getRealPath())
->resize(640, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode('jpg', 90);
$fileName = md5(uniqid()) . '.jpg';
$date = date('Y_m_d');
$ossFilePath = 'Carousel/'.$date.'/'.$fileName;
//获取文件的绝对路径
$path = $file->getRealPath();
$res = $aliOss->upload($ossFilePath, $path,'OSS_PUBLIC_BUCKET');
return $res
? $this->responseUploaded(env('OSS_PUBLIC_IMAGE_URL').$ossFilePath,'')
: $this->responseErrorMessage('文件上传失败');
}
/**
* 上传资源库图片
*/
public function uploadResourceImg()
{
$aliOss = new AilOss();
// 获取上传的文件
$file = $this->file();;
Image::make($file->getRealPath())
->resize(640, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode('jpg', 90);
$fileName = md5(uniqid()) . '.jpg';
$date = date('Y_m_d');
$ossFilePath = 'ResourceImg/'.$date.'/'.$fileName;
//获取文件的绝对路径
$path = $file->getRealPath();
$res = $aliOss->upload($ossFilePath, $path,'OSS_PUBLIC_BUCKET');
return $res
? $this->responseUploaded(env('OSS_PUBLIC_IMAGE_URL').$ossFilePath,'')
: $this->responseErrorMessage('文件上传失败');
}
//上传资源文件
public function uploadResourceFile()
{
$aliOss = new AilOss();
// 获取上传的文件
$file = $this->file();;
//获取文件扩展名
$ext = $file->getClientOriginalExtension();
$fileName = uniqid().'.'.$ext;
$date = date('Y_m_d');
$ossFilePath = 'ResourceFile/'.$date.'/'.$fileName;
//获取文件的绝对路径
$path = $file->getRealPath();
$res = $aliOss->upload($ossFilePath, $path,'OSS_PUBLIC_BUCKET');
return $res
? $this->responseUploaded(env('OSS_PUBLIC_IMAGE_URL').$ossFilePath,'')
: $this->responseErrorMessage('文件上传失败');
}
}
<?php
namespace App\Admin\Forms;
use App\Imports\ImportExcel as uImportExcel;
use App\Jobs\ansyImportExcel;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;
class ImportExcel extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$file_path = storage_path('app/public' . $input['e_file']);
dispatch(new ansyImportExcel($this->payload['className'], $file_path));
return $this
->response()
->success('导入成功,请稍后刷新页面查看数据.')
->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->file('e_file', '数据文件')
->disk('public')
->accept('xls,xlsx')
->uniqueName()
->move('/import')
->autoUpload()
->help('仅支持xls,xlsx格式文件上传')
->required();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
return [
'name' => 'John Doe',
'email' => 'John.Doe@gmail.com',
];
}
}
<?php
namespace App\Admin\Forms;
use App\Models\User;
use Dcat\Admin\Widgets\Form;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Illuminate\Support\Facades\DB;
class TruncateTable extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$status = (int)$input['status'];
$tablename = trim($this->payload['tablename']);
if ($status == 1 && $tablename) {
DB::table($tablename)->truncate(); // 清空数据表
}
return $this->response()->success('确认成功')->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->radio('status', '清空状态')->options([1 => '是', 0 => '否'])->default(0)->required();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
// 获取外部传递参数
return [];
}
}
<?php
namespace App\Admin\Forms;
use App\Models\PersonalAccessToken;
use App\Models\User;
use App\Models\UserPermission;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;
class updatePassword extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$user = User::find($this->payload['id']);
$user->password = bcrypt($input['password']);
if(!$user->save()){
return $this
->response()
->error('修改用户密码失败')
->refresh();
}
PersonalAccessToken::where(['tokenable_id'=>$user->id])->delete();
return $this
->response()
->success('修改用户密码成功.')
->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->display('name','姓名');
$this->display('phone','手机');
$this->text('password','密码')->required();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
$user = User::find($this->payload['id']);
return [
'name' => $user->name,
'phone' => $user->phone,
];
}
}
<?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 App\Models\Covenant as Model;
use App\Models\Principal;
use Dcat\Admin\Repositories\EloquentRepository;
class Covenant extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
//合同类型
public const CTYPE = [
1 => '民事诉讼代理',
2 => '刑事诉讼辩护及代理',
3 => '行政诉讼代理',
4 => '非诉讼法律事务',
5 => '咨询和代写法律文书',
6 => '仲裁业务',
7 => '法律援助',
];
//结算方式
public const PAYMENT_METHOD = [
1 => '开票付款',
2 => '付款开票'
];
public function principal()
{
return $this->belongsTo(Principal::class, 'principal_id', 'id');
}
}
<?php
namespace App\Admin\Repositories;
use App\Models\Lawyer as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Lawyer extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
//
public const SETTLEMENT_METHOD = [
1 => '贴票',
2 => '个税',
];
public const SETTLEMENT_PERIOD = [
1 => ' 月',
2 => '年',
];
}
<?php
namespace App\Admin\Repositories;
use App\Models\Lawyer;
use App\Models\LawyerCost as ModelLawyerCost;
//use Dcat\Admin\Repositories\EloquentRepository;
use Dcat\Admin\Repositories\Repository;
use Dcat\Admin\Grid;
use Illuminate\Support\Collection;
class LawyerCost extends Repository
{
/**
* Model.
*
* @var string
*/
//protected $eloquentClass = Model::class;
/**
* 各学部申报情况
* 项目类型 数理 化学 生命 地学 工材 信息 管理 医学 交叉 其他 总计
*/
public function get(Grid\Model $model)
{
// 获取筛选条件
$year = $model->filter()->input('year') ?? date("Y");
$data = [];
$nowyear = date('Y');
$monthNum = $year >= $nowyear ? date('m') : 12;
$list = ModelLawyerCost::COSTiTEM; //Lawyer::all();
foreach ($list as $key => $val) {
$tmp = [];
$tmp['title'] = $val['name']; //项目名称
//总计
$total = 10;
for ($i = 1; $i <= $monthNum; $i++) {
$tmp[$i] = $i;
}
//总计
$tmp['total'] = $total;
array_push($data, $tmp);
}
return $data;
// $data = [
// ['id' => 1, 'year' => '2016', 'jzsqNum' => '100', 'jzhpNum' => '100', 'sbTotal' => '100'],
// ['id' => 2, 'year' => '2017', 'jzsqNum' => '100', 'jzhpNum' => '100', 'sbTotal' => '100']
// ];
// return $data;
}
}
<?php
namespace App\Admin\Repositories;
use App\Models\Principal as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Principal extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
use Dcat\Admin\Admin;
use Dcat\Admin\Grid;
use Dcat\Admin\Form;
use Dcat\Admin\Grid\Filter;
use Dcat\Admin\Show;
/**
* Dcat-admin - admin builder based on Laravel.
* @author jqh <https://github.com/jqhph>
*
* Bootstraper for Admin.
*
* Here you can remove builtin form field:
*
* extend custom field:
* Dcat\Admin\Form::extend('php', PHPEditor::class);
* Dcat\Admin\Grid\Column::extend('php', PHPEditor::class);
* Dcat\Admin\Grid\Filter::extend('php', PHPEditor::class);
*
* Or require js and css assets:
* Admin::css('/packages/prettydocs/css/styles.css');
* Admin::js('/packages/prettydocs/js/main.js');
*
*/
use Dcat\Admin\Layout\Navbar;
admin_inject_section(Admin::SECTION['NAVBAR_USER_PANEL'], function () {
return view('admin.partials.navbar-user-panel', ['user' => Admin::user()]);
});
Admin::navbar(function (Navbar $navbar) {
$navbar->left('<div class="navbar-header">
<ul class="nav navbar-nav flex-row">
<li class="nav-item mr-auto">
<a href="/" class="navbar-brand waves-effect waves-light">
<span class="logo-lg"><img src="/vendor/dcat-admin/images/logo.jpg" width="40"> &nbsp;律所管理系统</span>
</a>
</li>
</ul>
</div>');
});
<?php
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Dcat\Admin\Admin;
Admin::routes();
Route::group([
'prefix' => config('admin.route.prefix'),
'namespace' => config('admin.route.namespace'),
'middleware' => config('admin.route.middleware'),
], function (Router $router) {
/****************************************************** 图片文件上传组件Start *********************************************************/
$router->match(['put', 'post'], 'upload/delete-oss-file', 'UploadController@deleteOssFile'); //删除OSS私有资源文件
$router->match(['put', 'post'], 'upload/delete-public-oss-file', 'UploadController@deletePublicOssFile'); //删除OSS公有资源文件
$router->match(['put', 'post'], 'upload/user-avatar', 'UploadController@uploadUserAvatar'); //上传用户头像
$router->match(['put', 'post'], 'upload/carousel', 'UploadController@uploadCarousel'); //上传轮播图
$router->match(['put', 'post'], 'upload/resource-img', 'UploadController@uploadResourceImg'); //上传资源图
$router->match(['put', 'post'], 'upload/resource-file', 'UploadController@uploadResourceFile'); //上传资源文件
/****************************************************** 图片文件上传组件end *********************************************************/
$router->get('/', 'HomeController@index');
$router->get('users/getUserType', 'UsersController@getUserType'); //人员类型列表(后台组件使用)
$router->get('users/getDepartmentType', 'UsersController@getDepartmentType'); //院系所类型列表(后台组件使用)
$router->get('users/getYearList', 'UsersController@getYearList'); //年度列表(后台组件使用)
$router->get('users/getProjectType', 'UsersController@getProjectType'); //项目类型列表(后台组件使用)
$router->get('department/getHospitalList', 'DepartmentController@getHospitalList'); //附属医院列表(后台组件使用)
//$router->resource('user', 'UserController'); //员工管理
$router->resource('principal', 'PrincipalController'); //委托人信息
$router->get('principal-list', 'PrincipalController@getList'); //委托人列表
$router->resource('lawyer', 'LawyerController'); //律师信息
$router->resource('covenant', 'CovenantController'); //合同信息
$router->resource('lawyer_cost', 'LawyerCostController'); //律师成本表
$router->resource('lycost-list', 'LawyerCostListController'); //律师成本明细
$router->resource('lycost-collect', 'LawyerCostCollectController'); //律师成本汇总
$router->resource('lawyer_income', 'LawyerIncomeController'); //律师创收表
$router->resource('lawyer-covenant-income', 'LawyerCovenantIncomeController'); //创收收款表
$router->resource('project_type', 'ProjectTypeController'); //项目类型
$router->resource('user_type', 'UserTypeController'); //人员类型
$router->resource('project_apply', 'ProjectApplyController'); //历年项目申请表
$router->resource('project_ratify', 'ProjectRatifyController'); //历年项目获批表
$router->resource('senior_professional', 'SeniorProfessionalController'); //高级职称参与表
/********************************** 历年 *****************************/
$router->resource('linian/declaration', 'DeclarationController'); //申报统计
Route::get('nd/declarationExport', 'DeclarationController@export'); //导出
$router->resource('linian/ratify', 'LnRatifyController'); //获批统计
Route::get('ln/ratifyExport', 'LnRatifyController@export'); //导出
$router->resource('linian/applyratify', 'LnApplyratifyController'); //申报获批汇总
Route::get('ln/applyRatifyExport', 'LnApplyratifyController@export'); //导出
$router->resource('linian/jyapplyratify', 'LnJyApplyratifyController'); //杰优、青优申报获批汇总
Route::get('ln/jyApplyratifyExport', 'LnJyApplyratifyController@export'); //导出
$router->resource('linian/department', 'LnDepartmentController'); //院系所历年获批
Route::get('ln/departmentExport', 'LnDepartmentController@export'); //导出
$router->resource('linian/hospital', 'LnHospitalController'); //院系所历年获批
Route::get('ln/hospitalExport', 'LnHospitalController@export'); //导出
$router->resource('linian/msratify', 'LnMsRatifyController'); //面上项目历年获批
Route::get('ln/msRatifyExport', 'LnMsRatifyController@export'); //导出
$router->resource('linian/qnratify', 'LnQnRatifyController'); //青年项目历年获批
Route::get('ln/qnRatifyExport', 'LnQnRatifyController@export'); //导出
});
<?php
namespace App\Command;
class Log{
static public function add(string $logKey, mixed $logInfo) :void{
//判断当天的日志文件是否存在
$day = date('Y-m-d');
$logFileName = 'runLog_'.$day.'.log';
$logPath = storage_path("logs/".$logFileName);
file_put_contents($logPath,date('【 H:i:s 】'.$logKey.': ').print_r($logInfo,true),FILE_APPEND);
}
}
<?php
namespace App\Command;
class Tools{
//计算俩地距离
function get_two_point_distance($lat1,$lng1,$lat2,$lng2)
{
$radLat1 = deg2rad($lat1);//deg2rad()函数将角度转换为弧度
$radLat2 = deg2rad($lat2);
$radLng1 = deg2rad($lng1);
$radLng2 = deg2rad($lng2);
$a = $radLat1 - $radLat2;
$b = $radLng1 - $radLng2;
$s = 2 * asin(sqrt(pow(sin($a / 2), 2) + cos($radLat1) * cos($radLat2) * pow(sin($b / 2), 2))) * 6378.137;
return round($s,2);//返回公里数
}
}
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* 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\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of exception types with their corresponding custom log levels.
*
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
*/
protected $levels = [
//
];
/**
* A list of the exception types that are not reported.
*
* @var array<int, class-string<\Throwable>>
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed to the session on validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->renderable(function (AuthenticationException $e) {
return [
'code' => 403,
'message' => "未通过身份验证",
'data'=>''
];
});
}
public function render($request, Throwable $exception)
{
/**
* Render an exception into an HTTP response.
*
* 替换渲染功能
* Request::isMethod('post') 请求方法为post
* $exception instanceof MethodNotAllowedHttpException $exception异常是MethodNotAllowedHttpException实例化的结果
* 此方式针对访问不存在的方法GET方法无用,将继续渲染一个404的页面,因此在api.php路由最后定义了一个回退路由,针对GET方法的
*/
// if (Request::isMethod('post') && $exception instanceof MethodNotAllowedHttpException) {
if ($exception instanceof MethodNotAllowedHttpException) {
return response()->json([
'code' => 404,
'msg' => '地址不存在',
'data' => null
], 200
);
}
return parent::render($request, $exception);
}
}
<?php
namespace App\Handlers;
use OSS\OssClient;
require_once '../vendor/aliyuncs/oss-sdk-php/autoload.php';
class AilOss
{
public static $oss;
/**
* @throws \OSS\Core\OssException
*/
public function __construct()
{
$accessKeyId = env('OSS_ACCESS_KEY_ID'); //获取阿里云oss的accessKeyId
$accessKeySecret = env('OSS_ACCESS_KEY_SECRET'); //获取阿里云oss的accessKeySecret
$endpoint = env('OSS_ENDPOINT'); //获取阿里云oss的endPoint
self::$oss = new OssClient($accessKeyId, $accessKeySecret, $endpoint); //实例化OssClient对象
}
/**
*
* 使用阿里云oss上传文件
* @param $object 保存到阿里云oss的文件名
* @param $filepath 文件在本地的绝对路径
* @return bool 上传是否成功
* @throws \OSS\Core\OssException
*/
public function upload($object, $filepath,$bucket ='OSS_BUCKET')
{
$res = false;
$bucket = env($bucket); //获取阿里云oss的bucket
if (self::$oss->uploadFile($bucket, $object, $filepath)) { //调用uploadFile方法把服务器文件上传到阿里云oss
$res = true;
}
return $res;
}
/**
* 删除指定文件
* @param $object string 被删除的文件名
* @return bool 删除是否成功
*/
public function delete(string $object,$bucket = 'OSS_BUCKET')
{
$res = false;
$bucket = env($bucket);
if (self::$oss->deleteObject($bucket, $object)){ //调用deleteObject方法把服务器文件上传到阿里云oss
$res = true;
}
return $res;
}
/**
* 删除指定文件
* @param $object 被删除的文件名
* @return bool 删除是否成功
*/
public function delete_array($objects,$bucket ='OSS_BUCKET')
{
$res = false;
$bucket = env($bucket);
if (self::$oss->deleteObjects($bucket, $objects)){ //调用deleteObject方法把服务器文件上传到阿里云oss
$res = true;
}
return $res;
}
/*获取文件的临时访问URL*/
public function getUrl($OssFilePath,$time = 1800,$bucket ='OSS_BUCKET')
{
// 生成一个带签名的URL,有效期是3600秒,可以直接使用浏览器访问。
$timeout = $time;
$bucket = env($bucket);
return self::$oss->signUrl($bucket,$OssFilePath,$timeout,"GET");
}
/**
* 在OSS中创建虚拟“文件夹”。名称不应以“/”结尾,因为该方法无论如何都会用“/”追加名称。
*
* Internal use only.
*
* @param string $dirName 文件夹名称
* @return bool
*/
public function createDir($dirName,$bucket = 'OSS_BUCKET')
{
$res = false;
$bucket = env($bucket);
if (self::$oss->createObjectDir($bucket, $dirName)) {
$res = true;
}
return $res;
}
/*获取指定目录下的目录与文件*/
public function fileList($dir, $maxKey = 1000, $delimiter = '/', $nextMarker = '') {
$fileList = []; // 获取的文件列表, 数组的一阶表示分页结果
$dirList = []; // 获取的目录列表, 数组的一阶表示分页结果
$storageList = [
'file' => [], // 真正的文件数组
'dir' => [], // 真正的目录数组
];
while (true) {
$options = [
'delimiter' => $delimiter,
'prefix' => $dir,
'max-keys' => $maxKey,
'marker' => $nextMarker,
];
$bucket = env('OSS_BUCKET');
try {
$fileListInfo = self::$oss->listObjects($bucket, $options);
// 得到nextMarker, 从上一次 listObjects 读到的最后一个文件的下一个文件开始继续获取文件列表, 类似分页
} catch (\Exception $e) {
return $e->getMessage(); // 发送错误信息
}
$nextMarker = $fileListInfo->getNextMarker();
$fileItem = $fileListInfo->getObjectList();
$dirItem = $fileListInfo->getPrefixList();
$fileList[] = $fileItem;
$dirList[] = $dirItem;
if ($nextMarker === '') break;
}
foreach ($fileList[0] as $item){
$storageList['file'][] = $this->objectInfoParse($item);
}
foreach ($dirList[0] as $item){
$storageList['dir'][] = $this->prefixInfoParse($item);
}
return $storageList; // 发送正确信息
}
/* 解析 prefixInfo 类 */
private function prefixInfoParse($prefixInfo){
return [
'dir' => $prefixInfo->getPrefix(),
];
}
/* 解析 objectInfo 类 */
public function objectInfoParse($objectInfo) {
return [
'name' => $objectInfo->getKey(),
'size' => $objectInfo->getSize(),
'update_at' => $objectInfo->getLastModified(),
];
}
}
<?php
namespace App\Handlers;
use Intervention\Image\Facades\Image;
use Illuminate\Support\Str;
class FileUploadHandler
{
// 只允许以下后缀名的图片文件上传
protected $allowed_ext = ["png", "jpg", 'jpeg', 'pdf'];
public function save($file)
{
$aliOss = new AilOss();
// 获取上传的文件
Image::make($file->getRealPath())
->resize(640, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode('jpg', 90);
$fileName = md5(uniqid()) . '.jpg';
$date = date('Y_m_d');
$ossFilePath = 'client/' . $date . '/' . $fileName;
//获取文件的绝对路径
$path = $file->getRealPath();
$res = $aliOss->upload($ossFilePath, $path, 'OSS_PUBLIC_BUCKET');
return $res ? env('OSS_PUBLIC_IMAGE_URL') . $ossFilePath : false;
}
}
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use Illuminate\Http\Response;
/**
* api基类
*/
class BaseController extends Controller
{
/**
* @param $data mixed 返回的数据
* @param $msg string 状态码
* @param $code int 返回的自定义信息
* @return Response
*/
protected function JsonResponse($data, string $msg='Success', int $code=200) :Response {
//组建返回结果
$result = [
'code' => $code,
'message' => $msg,
'data' => $data,
];
return response($result, 200);
}
}
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array<int, class-string|string>
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array<string, array<int, class-string|string>>
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:10000,1',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array<string, class-string|string>
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \App\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'acceptJson' => \App\Http\Middleware\AcceptJson::class,
];
}
<?php
namespace App\Http\Middleware;
use Closure;
class AcceptJson
{
/**
* Change the Request headers to "application/json" activating wantsJson()
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
$request->headers->set('Accept', 'application/json');
return $next($request);
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}
<?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<int, string>
*/
protected $except = [
//
];
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array<int, string>
*/
protected $except = [
//
];
}
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @param string|null ...$guards
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next, ...$guards)
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
}
return $next($request);
}
}
<?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<int, string>
*/
protected $except = [
'current_password',
'password',
'password_confirmation',
];
}
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array<int, string|null>
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array<int, string>|string|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
}
<?php
namespace App\Http\Middleware;
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
class ValidateSignature extends Middleware
{
/**
* The names of the query string parameters that should be ignored.
*
* @var array<int, string>
*/
protected $except = [
// 'fbclid',
// 'utm_campaign',
// 'utm_content',
// 'utm_medium',
// 'utm_source',
// 'utm_term',
];
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array<int, string>
*/
protected $except = [
//
];
}
<?php
namespace App\Imports;
use App\Command\Log;
use App\Models\Brand;
use App\Models\Category;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\ToCollection;
use function Matrix\trace;
class ImportExcel implements ToCollection
{
private $className = null;
public function __construct($className)
{
$this->className = $className;
}
public function sheets(): array
{
// 只处理第一个sheet
return [
0 => $this,
];
}
/**
* @param Collection $collection
*/
public function collection(Collection $rows)
{
set_time_limit(0);
// 去掉表头
unset($rows[0]);
unset($rows[1]);
$i = 0;
foreach ($rows as $k => &$item) {
if (!$item[1] || !$item[2] || !$item[3] || !$item[4]) {
continue;
}
$i++;
$item = array_slice($item->toArray(), 0, 21);
$result = $this->className::CreateImportData($item);
if (!$result) {
continue;
}
$insert[] = $result;
$key[] = $k;
if (is_int($i / 1000)) {
DB::table($this->className::getTableName())->insert($insert);
$insert = [];
unset($key);
$key = [];
}
}
if (!empty($insert)) {
DB::table($this->className::getTableName())->insert($insert);
}
}
public function getExt($filename)
{
$arr = explode('.', $filename);
return array_pop($arr);
}
}
<?php
namespace App\Jobs;
use App\Imports\ImportExcel;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Facades\Excel;
class ansyImportExcel implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private string $className;
private string $file_path;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($className, $file_path)
{
$this->className = $className;
$this->file_path = $file_path;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$toolOrder = new ImportExcel($this->className);
Excel::import($toolOrder, $this->file_path);
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Covenant extends Model
{
use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'covenant';
//合同类型
public const CTYPE = [
1 => '民事诉讼代理',
2 => '刑事诉讼辩护及代理',
3 => '行政诉讼代理',
4 => '非诉讼法律事务',
5 => '咨询和代写法律文书',
6 => '仲裁业务',
7 => '法律援助',
];
//结算方式
public const PAYMENT_METHOD = [
1 => '开票付款',
2 => '付款开票'
];
public function principal()
{
return $this->belongsTo(Principal::class, 'principal_id', 'id');
}
public function lawyer()
{
return $this->belongsTo(Lawyer::class, 'lawyer_id', 'id');
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class Lawyer extends Model
{
use HasDateTimeFormatter;
protected $table = 'lawyer';
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class LawyerCost extends Model
{
use HasDateTimeFormatter;
protected $table = 'lawyer_cost';
//月份
public const MONTH = [
1 => '1月',
2 => '2月',
3 => '3月',
4 => '4月',
5 => '5月',
6 => '6月',
7 => '7月',
8 => '8月',
9 => '9月',
10 => '10月',
11 => '11月',
12 => '12月',
];
//项目
public const COSTiTEM = [
['field' => 'basic_salary', 'name' => '基本工资'],
['field' => 'special_additional', 'name' => '专项附加'],
['field' => 'social_person_fee', 'name' => '社保'],
['field' => 'social_person_fee', 'name' => '社保个人部分'],
['field' => 'social_company_fee', 'name' => '社保单位部分'],
['field' => 'accumulation_fund', 'name' => '公积金'],
['field' => 'accumulation_fund_person_fee', 'name' => '公积金个人部分'],
['field' => 'accumulation_fund_company_fee', 'name' => '公积金单位部分'],
['field' => 'annual_inspection_fee', 'name' => '律所年检费'],
['field' => 'annuity', 'name' => '律所年金'],
['field' => 'posting_tickets_fee', 'name' => '贴票成本'],
['field' => 'assistant_fee', 'name' => '助理律师成本'],
['field' => 'office_rental_fee', 'name' => '办公室租赁成本'],
['field' => 'noticket_cost', 'name' => '无票成本'],
['field' => 'personal_income_tax', 'name' => '个人所得税'],
['field' => 'total', 'name' => '合计'],
];
}
<?php
// 表中存在软删除时,调用该模块,实现树行结构
namespace App\Models;
use Dcat\Admin\Traits\ModelTree;
trait NewModelTree
{
use ModelTree;
protected function buildSelectOptions(array $nodes = [], $parentId = 0, $prefix = '', $space = '&nbsp;', $cid = 0)
{
$d = '├─';
$prefix = $prefix ?: $d . $space;
$options = [];
if (empty($nodes)) {
if ($cid > 0) {
$where = ['deleted_at' => null, 'c_id' => $cid];
} else {
$where = ['deleted_at' => null];
}
$nodes = self::where($where)->orderBy('order', 'ASC')->get()->toArray();
}
foreach ($nodes as $index => $node) {
if ($node[$this->getParentColumn()] == $parentId) {
$currentPrefix = $this->hasNextSibling($nodes, $node[$this->getParentColumn()], $index) ? $prefix : str_replace($d, '└─', $prefix);
$node[$this->getTitleColumn()] = $currentPrefix . $space . $node[$this->getTitleColumn()];
$childrenPrefix = str_replace($d, str_repeat($space, 6), $prefix) . $d . str_replace([$d, $space], '', $prefix);
$children = $this->buildSelectOptions($nodes, $node[$this->getKeyName()], $childrenPrefix);
$options[$node[$this->getKeyName()]] = $node[$this->getTitleColumn()];
if ($children) {
$options += $children;
}
}
}
return $options;
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class PersonalAccessToken extends Model
{
use HasDateTimeFormatter;
protected $table = 'personal_access_tokens';
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class Principal extends Model
{
use HasDateTimeFormatter;
protected $table = 'principal';
}
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
Schema::defaultStringLength(191);
}
}
<?php
namespace App\Providers;
// use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The model to policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event to listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
//
}
/**
* Determine if events and listeners should be automatically discovered.
*
* @return bool
*/
public function shouldDiscoverEvents()
{
return false;
}
}
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
*
* Typically, users are redirected here after authentication.
*
* @var string
*/
public const HOME = '/home';
/**
* Define your route model bindings, pattern filters, and other route configuration.
*
* @return void
*/
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::domain(env('API_URL'))
->middleware('api')
->group(base_path('routes/api.php'));
Route::middleware('web')
->group(base_path('routes/web.php'));
});
}
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
}
}
<?php
namespace App\Store\Actions\Grid;
use App\Store\Forms\IncomeApply as FormIncomeApply;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Traits\HasPermissions;
use Dcat\Admin\Widgets\Modal;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
class IncomeApply extends RowAction
{
/**
* @return string
*/
protected $title = '<button class="btn btn-custom disable-outline "> 申请提现 </button>';
public function render()
{
$form = FormIncomeApply::make();
return Modal::make()
->lg()
->title('申请提现')
->body($form)
->scrollable(true)
->button($this->title);
}
/**
* @return string|array|void
*/
public function confirm()
{
// return ['Confirm?', 'contents'];
}
/**
* @param Model|Authenticatable|HasPermissions|null $user
*
* @return bool
*/
protected function authorize($user): bool
{
return true;
}
/**
* @return array
*/
protected function parameters()
{
return [];
}
}
<?php
namespace App\Store\Actions\Grid;
use App\Store\Forms\RefundToExamine as FormRefundToExamine;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Traits\HasPermissions;
use Dcat\Admin\Widgets\Modal;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
class RefundToExamine extends RowAction
{
/**
* @return string
*/
protected $title = '<span>退款审核</span>';
public function render()
{
$form = FormRefundToExamine::make()->payload(['id' => $this->getKey()]);
return Modal::make()
->lg()
->title($this->title)
->body($form)
->scrollable(true)
->button($this->title);
}
/**
* @return string|array|void
*/
public function confirm()
{
// return ['Confirm?', 'contents'];
}
/**
* @param Model|Authenticatable|HasPermissions|null $user
*
* @return bool
*/
protected function authorize($user): bool
{
return true;
}
/**
* @return array
*/
protected function parameters()
{
return [];
}
}
<?php
namespace App\Store\Actions\Grid;
use App\Store\Forms\SendOutGoods as FormSendOutGoods;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Traits\HasPermissions;
use Dcat\Admin\Widgets\Modal;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
class SendOutGoods extends RowAction
{
/**
* @return string
*/
protected $title = '<span>订单发货</span>';
public function render()
{
$form = FormSendOutGoods::make()->payload(['id' => $this->getKey()]);
return Modal::make()
->lg()
->title($this->title)
->body($form)
->scrollable(true)
->button($this->title);
}
/**
* @return string|array|void
*/
public function confirm()
{
// return ['Confirm?', 'contents'];
}
/**
* @param Model|Authenticatable|HasPermissions|null $user
*
* @return bool
*/
protected function authorize($user): bool
{
return true;
}
/**
* @return array
*/
protected function parameters()
{
return [];
}
}
<?php
namespace App\Store\Controllers;
use Dcat\Admin\Http\Controllers\AuthController as BaseAuthController;
class AuthController extends BaseAuthController
{
protected $view = 'admin.login';
}
<?php
namespace App\Store\Controllers;
use App\Models\StoreInfo;
use App\Store\Metrics\Examples;
use App\Http\Controllers\Controller;
use Dcat\Admin\Admin;
use Dcat\Admin\Http\Controllers\Dashboard;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Layout\Row;
use Dcat\Admin\Widgets\Card;
class HomeController extends Controller
{
public function index(Content $content)
{
return $content
->header('主页')
->description('数据总览')
->body(function (Row $row) {
$row->column(6, function (Column $column) {
$column->row(new Examples\Revenue());
});
$row->column(6, function (Column $column) {
$store = StoreInfo::where(['store_id'=>Admin::user()->id])->first();
$total_revenue = $store->total_revenue > 1000 ? round(2,($store->total_revenue/1000)).' 千' : $store->total_revenue;
$balance = $store->balance > 1000 ? round(2,($store->balance/1000)).' 千' : $store->balance;
$freeze_balance = $store->freeze_balance > 1000 ? round(2,($store->freeze_balance/1000)).' 千' : $store->freeze_balance;
$content = '<div style="height: 135px;display: flex;align-items: center;text-align: center;">
<div style="flex: 1;display: flex;flex-direction: column;border-right: 1px solid #b9c3cd;">
<h2 style="font-size: 25px;margin-top: 25px;">总收益</h2>
<p style="color: orange;font-size: 45px;font-weight: bold;">'.$total_revenue.'</p>
</div>
<div style="flex: 1;display: flex;flex-direction: column;border-right: 1px solid #b9c3cd;">
<h2 style="font-size: 25px;margin-top: 25px;">余额(可提现)</h2><p style="color:#21b978;font-size: 45px;font-weight: bold;">'.$balance.'</p>
</div>
<div style="flex: 1;display: flex;flex-direction: column;">
<h2 style="font-size: 25px;margin-top: 25px;">冻结金额(提现中)</h2><p style="color: red;font-size: 45px;font-weight: bold;">'.$freeze_balance.'</p>
</div></div>';
$column->row(new Card('',$content));
});
$row->column(12, function (Column $column) {
$column->row(new Examples\StoreOrderChats());
});
});
}
}
<?php
namespace App\Store\Controllers;
use App\Models\StoreGood;
use App\Models\StoreGoodsCategory;
use App\Models\StoreGoodsTag;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class StoreGoodController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(StoreGood::with('store_category'), function (Grid $grid) {
$grid->addTableClass(['table-text-center']);
$grid->model()->where(['store_id'=>Admin::user()->id])->orderBy('created_at','DESC');
$grid->column('id')->sortable();
$grid->column('title');
$grid->column('store_category.title','商品类别')->label('default');
$grid->column('tags')->display(function ($vel) {
if ($vel) {
$html = '';
$rel = json_decode($vel,true);
foreach ($rel as $k=>$t) {
$html .= '<span class="badge" style="background:green">' . StoreGoodsTag::find($t)->title . '</span>';
if((($k+1)%2) == 0){
$html .= '<br />';
}
}
return $html;
} else {
return '未设置';
}
});
$grid->column('price');
$grid->column('sale_price');
$grid->column('small_cover')->image(env('IMAGE_URL'),50);
$grid->column('cover')->image(env('IMAGE_URL'),50);
$grid->column('intro')->if(function ($column){
return $column->getValue();
})->then(function (Grid\Column $column){
$column->display('点击查看')->modal(function (Grid\Displayers\Modal $modal){
$modal->title('商品描述');
$modal->xl();
return $this->intro;
});
})->else(function (Grid\Column $column) {
$column->display('未设置');
});
$grid->column('look_num');
$grid->column('inventory');
$grid->column('updated_at')->sortable();
$grid->simplePaginate();
$grid->setDialogFormDimensions('70%', '90%');
$grid->enableDialogCreate();
$grid->showQuickEditButton();
$grid->disableEditButton();
$grid->disableViewButton();
$grid->simplePaginate();
$grid->disableFilterButton();
$grid->quickSearch('title')->placeholder('搜索商品');
$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 StoreGood(), function (Show $show) {
$show->field('id');
$show->field('title');
$show->field('tags');
$show->field('price');
$show->field('sale_price');
$show->field('small_cover');
$show->field('cover');
$show->field('category_id');
$show->field('intro');
$show->field('look_num');
$show->field('inventory');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new StoreGood(), function (Form $form) {
if($form->isCreating()){
$form->hidden('store_id')->value(Admin::user()->id);
}
$form->text('title');
$form->multipleSelect('tags')
->options(StoreGoodsTag::where(['store_id'=>Admin::user()->id])->get()->pluck('title','id'))
->saving(function ($value) {
return $value ? json_encode($value) : null;
});
$form->currency('price')->symbol('¥');
$form->currency('sale_price')->symbol('¥');
$form->image('small_cover')->accept('jpg,jpeg,png')
->maxSize(4096)
->url('upload/store')
->help('仅支持jpg、jpeg、png格式图片上传')
->autoUpload();
$form->image('cover')->accept('jpg,jpeg,png')
->maxSize(4096)
->url('upload/store')
->help('仅支持jpg、jpeg、png格式图片上传')
->autoUpload();
$form->select('category_id')
->options(StoreGoodsCategory::where(['store_id'=>Admin::user()->id])->get()->pluck('title','id'))
->default(0)->required();
$form->editor('intro') ->imageUrl('upload/store')
->height(400);
$form->number('inventory');
$form->disableDeleteButton();
$form->disableEditingCheck();
$form->disableViewButton();
$form->disableViewCheck();
$form->disableCreatingCheck();
});
}
}
<?php
namespace App\Store\Controllers;
use App\Models\StoreGoodsCategory;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class StoreGoodsCategoryController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new StoreGoodsCategory(), function (Grid $grid) {
$grid->addTableClass(['table-text-center']);
$grid->model()->where(['store_id'=>Admin::user()->id])->orderBy('created_at','DESC');
$grid->view('admin.grid.tags');
$grid->setActionClass(Grid\Displayers\Actions::class);
$grid->column('id')->sortable();
$grid->column('store_id');
$grid->column('title');
$grid->column('created_at');
$grid->column('updated_at')->sortable();
$grid->enableDialogCreate();
$grid->showQuickEditButton();
$grid->disableEditButton();
$grid->disableViewButton();
$grid->disableBatchDelete();
$grid->simplePaginate();
$grid->disableFilterButton();
$grid->quickSearch('title')->placeholder('搜索分类');
$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 StoreGoodsCategory(), function (Show $show) {
$show->field('id');
$show->field('store_id');
$show->field('title');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new StoreGoodsCategory(), function (Form $form) {
if($form->isCreating()){
$form->hidden('store_id')->value(Admin::user()->id);
}
$form->text('title');
});
}
}
<?php
namespace App\Store\Controllers;
use App\Models\StoreGoodsTag;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class StoreGoodsTagController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new StoreGoodsTag(), function (Grid $grid) {
$grid->addTableClass(['table-text-center']);
$grid->model()->where(['store_id'=>Admin::user()->id])->orderBy('created_at','DESC');
$grid->column('id')->sortable();
$grid->view('admin.grid.tags');
$grid->model()->where(['deleted_at' => null]);
$grid->setActionClass(Grid\Displayers\Actions::class);
$grid->column('title');
$grid->column('created_at');
$grid->column('updated_at')->sortable();
$grid->enableDialogCreate();
$grid->showQuickEditButton();
$grid->disableEditButton();
$grid->disableViewButton();
//$grid->disableDeleteButton();
$grid->disableBatchDelete();
$grid->simplePaginate();
$grid->disableFilterButton();
$grid->quickSearch('title')->placeholder('搜索标签');
$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 StoreGoodsTag(), function (Show $show) {
$show->field('id');
$show->field('title');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new StoreGoodsTag(), function (Form $form) {
if($form->isCreating()){
$form->hidden('store_id')->value(Admin::user()->id);
}
$form->text('title');
});
}
}
<?php
namespace App\Store\Controllers;
use App\Models\StoreIncome;
use App\Store\Actions\Grid\IncomeApply;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Widgets\Card;
class StoreIncomeController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new StoreIncome(), function (Grid $grid) {
$grid->tools(new IncomeApply());
$grid->addTableClass(['table-text-center']);
$grid->model()->where(['store_id'=>Admin::user()->id])->orderBy('created_at','DESC');
$grid->column('id')->sortable();
$grid->column('amount','金额');
$grid->column('invoice')->if(function ($column){
return $column->getValue();
})->display('点击查看')->modal(function ($modal){
//设置弹窗标题
$modal->title('发票信息');
$content = '';
$invoice = json_decode($this->invoice);
foreach ($invoice as $item){
$content .= '<br/><img src="'.env("IMAGE_URL").$item.'">';
}
$card = new Card(null, $content);
return "<div style='padding:10px 10px 0;text-align: center'>$card</div>";
})->else(function ($column){
return '未设置';
});
$grid->column('feedback')->limit(20);
$grid->column('status')->using(StoreIncome::STATUS)->dot([
0 => 'primary',
1 => 'success',
2 => 'danger'
]);
$grid->column('created_at');
$grid->disableDeleteButton();
$grid->disableViewButton();
$grid->disableCreateButton();
$grid->disableBatchActions();
$grid->showQuickEditButton();
$grid->simplePaginate();
$grid->disableFilterButton();
$grid->selector(function (Grid\Tools\Selector $selector) {
$selector->selectOne('status', '状态',StoreIncome::STATUS);
});
$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 StoreIncome(), function (Show $show) {
$show->field('id');
$show->field('amout');
$show->field('invoice');
$show->field('feedback');
$show->field('status');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new StoreIncome(), function (Form $form) {
$form->currency('amount','金额')->symbol('¥')->required();
$form->multipleImage('invoice','发票信息')
->accept('jpg,jpeg,png')
->maxSize(2048)
->limit(9)
->url('upload/store-invoice')
->help('仅支持jpg、jpeg、png格式图片上传')
->autoUpload()
->saveAsJson();
});
}
}
<?php
namespace App\Store\Controllers;
use App\Models\UserAddress;
use App\Models\UserRefund;
use App\Store\Actions\Grid\RefundToExamine;
use App\Store\Actions\Grid\SendOutGoods;
use App\Models\StoreOrder;
use App\Models\TotalOrder;
use App\Models\User;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Widgets\Card;
class StoreOrderController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(StoreOrder::with(['order','store_info','store_goods']), function (Grid $grid) {
$grid->addTableClass(['table-text-center']);
$grid->model()->where(['store_id'=>Admin::user()->id])->orderBy('created_at','DESC');
$grid->column('id')->sortable();
$grid->column('store_goods.title','商品');
$grid->column('num');
$grid->column('order.pay_money','金额');
$grid->column('store_info.name','商户');
$grid->column('order.uid','用户')->display(function ($val){
return User::find($val)->name ?? '';
});
$grid->column('address_id','收货信息')->if(function ($column){
return $column->getValue();
})->display('点击查看')
->modal(function ($modal){
//设置弹窗标题
$modal->title('收货信息');
$address = UserAddress::find($this->address_id);
$name = $address->name ?? '';
$phone = $address->phone ?? '';
$area = $address->area ?? '';
$address = $address->address ?? '';
$content = '<p>收货人 :'. $name .'</p><br/><p>电话 :'.$phone.'</p><br/><p>所在地区 :'.$area.'</p><br/><p>详细地址 :'.$address.'</p>';
$card = new Card(null, $content);
return "<div style='padding:10px 10px 0'>$card</div>";
})->else(function (Grid\Column $column) {
return '';
});
$grid->column('status','流程状态')
->if(function ($column){
return $column->getValue() == 0 && $this->order->status == 1;
})->display('点击发货')
->expand(new SendOutGoods())
->if(function ($column){
return $column->getValue() == 3 && in_array($this->order->status,[1,2]);
})->display('退款审核')
->expand(new RefundToExamine())
->else(function ($column){
$column->using(StoreOrder::STATUS)->dot([
0=>'#b9c3cd',
1=>'#59a9f8',
2=>'#21b978',
3=>'#dda451',
4=>'#ea5455',
]);
});
$grid->column('order.status','订单状态')
->using(TotalOrder::STATUS)
->dot([
0 => '#b9c3cd',
1 => '#59a9f8',
2 => '#21b978',
7 => '#dda451',
8 => '#ea5455',
]);
$grid->column('发货物流')->display(function (){
if(!$this->logistics || !$this->logistics_code){
return '';
}
return $this->logistics_code . "[$this->logistics]";
});
$grid->column('退货物流')->display(function (){
if(!$this->refund_logistics || !$this->refund_logistics_code){
return '';
}
return $this->refund_logistics_code . "[$this->refund_logistics]";
});
$grid->column('退款申请信息') ->if(function ($column){
return $this->status == 3;
})->display('点击查看')->modal(function ($modal){
//设置弹窗标题
$modal->title('退款申请信息');
$userRefund = UserRefund::where(['order_id'=>$this->order->id,'son_order_id'=>$this->id])->first();
$phone = $userRefund->phone ??'';
$content = '<p>原因 :'. $this->order->refund_reason .'</p><br/><p>电话 :'.$phone.'</p>';
if($this->voucher){
$voucher = json_decode($this->voucher);
$content .= '<br/><p>凭证图片:</p>';
foreach ($voucher as $item){
$content .= '<br/><img src="'.env("IMAGE_URL").$item.'">';
}
}
$card = new Card(null, $content);
return "<div style='padding:10px 10px 0'>$card</div>";
})->else(function ($column){
return '';
});
$grid->column('created_at');
$grid->simplePaginate();
$grid->disableActions();
$grid->disableCreateButton();
$grid->disableBatchActions();
$grid->simplePaginate();
$grid->disableFilterButton();
$grid->quickSearch('store_goods.title')->placeholder('搜索商品');
$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 StoreOrder(), function (Show $show) {
$show->field('id');
$show->field('order_id');
$show->field('goods_id');
$show->field('num');
$show->field('address_id');
$show->field('status');
$show->field('over_time');
$show->field('voucher');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new StoreOrder(), function (Form $form) {
$form->display('id');
$form->text('order_id');
$form->text('goods_id');
$form->text('num');
$form->text('address_id');
$form->text('status');
$form->text('over_time');
$form->text('voucher');
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Store\Controllers;
use Dcat\Admin\Traits\HasUploadedFile;
use Intervention\Image\Facades\Image;
class UploadFileController{
use HasUploadedFile;
public function storeUpload()
{
$disk = $this->disk();
// 判断是否是删除文件请求
if ($this->isDeleteRequest()) {
// 删除文件并响应
return $this->deleteFileAndResponse();
}
// 获取上传的文件
$file = $this->file();
$img = Image::make($file->getRealPath())
->resize(640, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode('jpg', 90);
$dir = '/store';
$newName = md5(uniqid()) . '.jpg';
$path = "{$dir}/$newName";
$result = $disk->put($path, $img);
return $result
? $this->responseUploaded($path, $disk->url($path))
: $this->responseErrorMessage('文件上传失败');
}
public function storeInvoiceUpload()
{
$disk = $this->disk();
// 判断是否是删除文件请求
if ($this->isDeleteRequest()) {
// 删除文件并响应
return $this->deleteFileAndResponse();
}
// 获取上传的文件
$file = $this->file();
$img = Image::make($file->getRealPath())
->resize(640, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode('jpg', 90);
$dir = '/storeInvoice';
$newName = md5(uniqid()) . '.jpg';
$path = "{$dir}/$newName";
$result = $disk->put($path, $img);
return $result
? $this->responseUploaded($path, $disk->url($path))
: $this->responseErrorMessage('文件上传失败');
}
}
<?php
namespace App\Store\Forms;
use App\Command\Log;
use App\Models\StoreIncome;
use App\Models\StoreInfo;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Form;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Illuminate\Support\Facades\DB;
class IncomeApply extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$store = StoreInfo::where(['store_id'=>Admin::user()->id]);
if($store->balance < $input['amount']){
return $this->response()->error('当前余额不足,提现申请失败')->refresh();
}
DB::beginTransaction();
try {
$model = new StoreIncome();
$model->store_id = Admin::user()->id;
$model->amount = $input['amount'];
$model->invoice = $input['invoice'] ??'';
$model->save();
$store->balance -= $input['amount'];
$store->freeze_balance += $input['amount'];
$store->save();
DB::commit();
Log::add('商城商户提现申请',$model->toArray());
}catch (\Exception $exception){
DB::rollBack();
Log::add('商城商户提现申请失败',$exception);
return $this->response()->error('提现申请失败')->refresh();
}
return $this->response()->success('提现申请成功')->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->currency('amount','金额')->symbol('¥')->required();
$this->multipleImage('invoice','发票信息')
->accept('jpg,jpeg,png')
->maxSize(2048)
->limit(9)
->url('upload/store-invoice')
->help('仅支持jpg、jpeg、png格式图片上传')
->autoUpload()
->saveAsJson();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
// 获取外部传递参数
return [];
}
}
<?php
namespace App\Store\Forms;
use App\Command\Log;
use App\Models\Pay;
use App\Models\PaymentRecord;
use App\Models\StoreGood;
use App\Models\StoreInfo;
use App\Models\StoreOrder;
use App\Models\UserRefund;
use Dcat\Admin\Widgets\Form;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Illuminate\Support\Facades\DB;
class RefundToExamine extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$model = StoreOrder::find($this->payload['id']);
DB::beginTransaction();
try {
$userRefund = UserRefund::where([
'order_id'=>$model->order->id,
'son_order_id'=>$model->id
])->first();
if($input['refund_status']){
if($model->order->status == 2){
$store = StoreInfo::find($model->store_id);
$store->total_revenue -= $model->order->pay_money;
$store->balance -= $model->order->pay_money;
$store->save();
}
$wxOrderSn = PaymentRecord::where(['order_id'=>$model->order_id])->first()->other_order;
$r_sn = Pay::refund($wxOrderSn,$model->order->pay_money,$model->order->refund_amount);
$userRefund->refund_no = $r_sn;
$userRefund->status = 1;
$userRefund->save();
$model->status = 4;
$model->save();
$model->order->status = 8;
$model->order->save();
$goods = StoreGood::find($model->goods_id);
$goods->sale_num -= $model->num;
$goods->inventory += $model->num;
$goods->save();
Log::add('审批同意退款完成',$model->toArray());
DB::commit();
}else{
$userRefund->status = 2;
$userRefund->save();
$model->status = $userRefund->son_order_status;
$model->save();
}
DB::commit();
Log::add('退款审批',$model->toArray());
}catch (\Exception $exception){
DB::rollBack();
Log::add('退款审批失败',$exception);
return $this->response()->error('退款审批失败')->refresh();
}
return $this->response()->success('退款审批成功')->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->radio('refund_status','退款审批')->options([true=>'同意退款',false=>'拒绝退款'])->required();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
// 获取外部传递参数
return [];
}
}
<?php
namespace App\Store\Forms;
use App\Jobs\AutoCompleteOrder;
use App\Models\StoreOrder;
use App\Models\TotalOrder;
use Dcat\Admin\Widgets\Form;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
class SendOutGoods extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$model = StoreOrder::find($this->payload['id']);
if($input['logistics']=='' || $input['logistics_code']=='' ){
return $this->response()->error('确认发货失败')->refresh();
}
$model->logistics = $input['logistics'] ??'';
$model->logistics_code = $input['logistics_code'] ??'';
$model->status = 1;
if (!$model->save()) {
return $this->response()->error('确认发货失败')->refresh();
}
$order = TotalOrder::find($model->order_id);
//开启自动完成订单
dispatch(new AutoCompleteOrder($order,(7*24*3600)));
return $this->response()->success('确认发货成功')->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->text('logistics','物流名称')->required();
$this->text('logistics_code','物流单号')->required();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
// 获取外部传递参数
return [];
}
}
<?php
namespace App\Store\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\Store\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\Store\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\Store\Metrics\Examples;
use App\Models\StoreOrder;
use Dcat\Admin\Widgets\Metrics\Line;
use Illuminate\Http\Request;
class Revenue extends Line
{
/**
* 初始化卡片内容
*
* @return void
*/
protected function init()
{
parent::init();
$this->title('收益');
$this->dropdown([
'7' => '最近7天',
'30' => '最近30天',
'365' => '最近一年',
]);
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
$data = StoreOrder::getYearSale();
// 卡片内容
$total = $data['total'] > 1000 ? round(2,($data['total']/1000)).' 千' : $data['total'];
$this->withContent($total);
// 图表数据
$this->withChart($data['list']);
break;
case '30':
$data = StoreOrder::getNumDaySale(30);
// 卡片内容
$total = $data['total'] > 1000 ? round(2,($data['total']/1000)).' 千' : $data['total'];
$this->withContent($total);
// 图表数据
$this->withChart($data['list']);
break;
case '7':
default:
$data = StoreOrder::getNumDaySale(7);
// 卡片内容
$total = $data['total'] > 1000 ? round(2,($data['total']/1000)).' 千' : $data['total'];
$this->withContent($total);
// 图表数据
$this->withChart($data['list']);
}
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
$series_data = [];
foreach ($data as $v){
$series_data[] = $v;
}
return $this->chart([
'series' => [
[
'name' =>'收益',
'data' => $series_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\Store\Metrics\Examples;
use App\Models\StoreOrder;
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',
'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 '30':
$data = StoreOrder::getNumDaySale(30);
$this->withContent($data['total'], $data['balance']);
// 图表数据
$this->withChart([
[
'name' => '收益',
'data' => array_values($data['list']),
],
]);
break;
case '7':
default:
// 卡片内容
$data = StoreOrder::getNumDaySale(30);
$this->withContent($data['total'], $data['balance']);
// 图表数据
$this->withChart([
[
'name' => '收益',
'data' => array_values([51,15,63,88,16,77,51]),
],
]);
}
}
/**
* 设置图表数据.
*
* @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\Store\Metrics\Examples;
use App\Models\StoreOrder;
use Dcat\Admin\Widgets\Metrics\Line;
use Illuminate\Http\Request;
class StoreOrderChats extends Line
{
/**
* 初始化卡片内容
*
* @return void
*/
protected function init()
{
parent::init();
$this->title('已完成订单');
$this->dropdown([
'7' => '最近7天',
'30' => '最近30天',
'365' => '最近一年',
]);
$this->height(600);
$this->chartHeight(500);
$this->chartOptions = [
'colors' =>['#FF69B4'],
'chart' => [
'type' => 'area',
'dropShadow' => [
'enabled' => true,
'color' => '#000',
'top' => 18,
'left' => 7,
'blur' => 10,
'opacity' => 0.2
],
'toolbar' => [
'show' => false
],
'zoom' => [
//关闭缩放
'enabled' => false
]
],
'stroke' => [
'show' => true,
'width' => 1,
'colors' => ['#77B6EA'],
'curve' => 'smooth'
],
// 'fill' => [
// 'type' => 'gradient',
// 'gradient'=>[
// 'opacityFrom' => 0.6,
// 'opacityTo'=> 0.8
// ]
// ],
'grid' => [
'borderColor' => '#e7e7e7',
'row' => [
'opacity' => 0.5
],
],
//圆点大小
'markers' => [
'size' => 0
],
'dataLabels' => [
'enabled' => false,
'offsetX' => 0,
'style' => [
'fontSize' => '12px',
'colors' => ['#FFFFFF']
]
],
'plotOptions' => [
'line' => [
'horizontal' => true,
'dataLabels' => [
'position' => 'top',
],
]
],
'xaxis' => [
'categories' => [],
],
];
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
$data = StoreOrder::getYearOrder();
// 卡片内容
$this->withContent('总量: '.$data['total']);
// 图表数据
$this->withChart($data['list']);
break;
case '30':
$data = StoreOrder::getNumDayOrder(30);
// 卡片内容
$this->withContent('总量: '.$data['total']);
// 图表数据
$this->withChart($data['list']);
break;
case '7':
default:
$data = StoreOrder::getNumDayOrder(7);
// 卡片内容
$this->withContent('总量: '.$data['total']);
// 图表数据
$this->withChart($data['list']);
}
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
$days = [];
$order_data = [
];
foreach ($data as $k=>$v){
$days[] = $k;
$order_data[] = $v;
}
return $this->chart([
'series' => [
[
'name' =>'完成订单',
'data' =>$order_data
],
],
'xaxis' => [
'categories'=> $days
],
]);
}
/**
* 设置卡片内容.
*
* @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\Store\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\Store\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\Store\Models;
use Illuminate\Database\Seeder;
class AdminTablesSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$createdAt = date('Y-m-d H:i:s');
// create a user.
Administrator::truncate();
Administrator::create([
'username' => 'admin',
'password' => bcrypt('admin'),
'name' => 'Administrator',
'created_at' => $createdAt,
]);
// create a role.
Role::truncate();
Role::create([
'name' => 'Administrator',
'slug' => Role::ADMINISTRATOR,
'created_at' => $createdAt,
]);
// add role to user.
Administrator::first()->roles()->save(Role::first());
//create a permission
Permission::truncate();
Permission::insert([
[
'id' => 1,
'name' => 'Auth management',
'slug' => 'auth-management',
'http_method' => '',
'http_path' => '',
'parent_id' => 0,
'order' => 1,
'created_at' => $createdAt,
],
[
'id' => 2,
'name' => 'Users',
'slug' => 'users',
'http_method' => '',
'http_path' => '/auth/users*',
'parent_id' => 1,
'order' => 2,
'created_at' => $createdAt,
],
[
'id' => 3,
'name' => 'Roles',
'slug' => 'roles',
'http_method' => '',
'http_path' => '/auth/roles*',
'parent_id' => 1,
'order' => 3,
'created_at' => $createdAt,
],
[
'id' => 4,
'name' => 'Permissions',
'slug' => 'permissions',
'http_method' => '',
'http_path' => '/auth/permissions*',
'parent_id' => 1,
'order' => 4,
'created_at' => $createdAt,
],
[
'id' => 5,
'name' => 'Menu',
'slug' => 'menu',
'http_method' => '',
'http_path' => '/auth/menu*',
'parent_id' => 1,
'order' => 5,
'created_at' => $createdAt,
],
[
'id' => 6,
'name' => 'Extension',
'slug' => 'extension',
'http_method' => '',
'http_path' => '/auth/extensions*',
'parent_id' => 1,
'order' => 6,
'created_at' => $createdAt,
],
]);
// Role::first()->permissions()->save(Permission::first());
// add default menus.
Menu::truncate();
Menu::insert([
[
'parent_id' => 0,
'order' => 1,
'title' => 'Index',
'icon' => 'feather icon-bar-chart-2',
'uri' => '/',
'created_at' => $createdAt,
],
[
'parent_id' => 0,
'order' => 2,
'title' => 'Admin',
'icon' => 'feather icon-settings',
'uri' => '',
'created_at' => $createdAt,
],
[
'parent_id' => 2,
'order' => 3,
'title' => 'Users',
'icon' => '',
'uri' => 'auth/users',
'created_at' => $createdAt,
],
[
'parent_id' => 2,
'order' => 4,
'title' => 'Roles',
'icon' => '',
'uri' => 'auth/roles',
'created_at' => $createdAt,
],
[
'parent_id' => 2,
'order' => 5,
'title' => 'Permission',
'icon' => '',
'uri' => 'auth/permissions',
'created_at' => $createdAt,
],
[
'parent_id' => 2,
'order' => 6,
'title' => 'Menu',
'icon' => '',
'uri' => 'auth/menu',
'created_at' => $createdAt,
],
[
'parent_id' => 2,
'order' => 7,
'title' => 'Extensions',
'icon' => '',
'uri' => 'auth/extensions',
'created_at' => $createdAt,
],
]);
(new Menu())->flushCache();
}
}
<?php
namespace App\Store\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Dcat\Admin\Traits\HasPermissions;
use Illuminate\Auth\Authenticatable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\URL;
/**
* Class Administrator.
*
* @property Role[] $roles
*/
class Administrator extends Model implements AuthenticatableContract
{
use Authenticatable,
HasPermissions,
HasDateTimeFormatter;
const DEFAULT_ID = 1;
protected $fillable = ['username', 'password', 'name', 'avatar'];
/**
* Create a new Eloquent model instance.
*
* @param array $attributes
*/
public function __construct(array $attributes = [])
{
$this->init();
parent::__construct($attributes);
}
protected function init()
{
$connection = config('store.database.connection') ?: config('database.default');
$this->setConnection($connection);
$this->setTable(config('store.database.users_table'));
}
/**
* Get avatar attribute.
*
* @return mixed|string
*/
public function getAvatar()
{
$avatar = $this->avatar;
if ($avatar) {
if (! URL::isValidUrl($avatar)) {
$avatar = Storage::disk(config('store.upload.disk'))->url($avatar);
}
return $avatar;
}
return admin_asset(config('store.default_avatar') ?: '@admin/images/default-avatar.jpg');
}
/**
* A user has and belongs to many roles.
*
* @return BelongsToMany
*/
public function roles(): BelongsToMany
{
$pivotTable = config('store.database.role_users_table');
$relatedModel = config('store.database.roles_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'user_id', 'role_id')->withTimestamps();
}
/**
* 判断是否允许查看菜单.
*
* @param array|Menu $menu
* @return bool
*/
public function canSeeMenu($menu)
{
return true;
}
}
<?php
namespace App\Store\Models;
use Illuminate\Database\Eloquent\Model;
class Extension extends Model
{
protected $fillable = ['name', 'is_enabled', 'version', 'options'];
protected $casts = [
'options' => 'json',
];
/**
* {@inheritDoc}
*/
public function __construct(array $attributes = [])
{
$this->init();
parent::__construct($attributes);
}
protected function init()
{
$connection = config('store.database.connection') ?: config('database.default');
$this->setConnection($connection);
$this->setTable(config('store.database.extensions_table') ?: 'admin_extensions');
}
}
<?php
namespace App\Store\Models;
use Illuminate\Database\Eloquent\Model;
class ExtensionHistory extends Model
{
protected $fillable = ['name', 'type', 'version', 'detail'];
/**
* {@inheritDoc}
*/
public function __construct(array $attributes = [])
{
$this->init();
parent::__construct($attributes);
}
protected function init()
{
$connection = config('store.database.connection') ?: config('database.default');
$this->setConnection($connection);
$this->setTable(config('store.database.extension_histories_table') ?: 'admin_extension_histories');
}
}
<?php
namespace App\Store\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Dcat\Admin\Traits\ModelTree;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Spatie\EloquentSortable\Sortable;
/**
* Class Menu.
*
* @property int $id
*
* @method where($parent_id, $id)
*/
class Menu extends Model implements Sortable
{
use HasDateTimeFormatter,
MenuCache,
ModelTree {
allNodes as treeAllNodes;
ModelTree::boot as treeBoot;
}
/**
* @var array
*/
protected $sortable = [
'sort_when_creating' => true,
];
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['parent_id', 'order', 'title', 'icon', 'uri', 'extension', 'show'];
/**
* Create a new Eloquent model instance.
*
* @param array $attributes
*/
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
$this->init();
}
protected function init()
{
$connection = config('store.database.connection') ?: config('database.default');
$this->setConnection($connection);
$this->setTable(config('store.database.menu_table'));
}
/**
* A Menu belongs to many roles.
*
* @return BelongsToMany
*/
public function roles(): BelongsToMany
{
$pivotTable = config('store.database.role_menu_table');
$relatedModel = config('store.database.roles_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'menu_id', 'role_id')->withTimestamps();
}
public function permissions(): BelongsToMany
{
$pivotTable = config('store.database.permission_menu_table');
$relatedModel = config('store.database.permissions_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'menu_id', 'permission_id')->withTimestamps();
}
/**
* Get all elements.
*
* @param bool $force
* @return static[]|\Illuminate\Support\Collection
*/
public function allNodes(bool $force = false)
{
if ($force || $this->queryCallbacks) {
return $this->fetchAll();
}
return $this->remember(function () {
return $this->fetchAll();
});
}
/**
* Fetch all elements.
*
* @return static[]|\Illuminate\Support\Collection
*/
public function fetchAll()
{
return $this->withQuery(function ($query) {
if (static::withPermission()) {
$query = $query->with('permissions');
}
return $query->with('roles');
})->treeAllNodes();
}
/**
* Determine if enable menu bind permission.
*
* @return bool
*/
public static function withPermission()
{
return config('store.menu.bind_permission') && config('store.permission.enable');
}
/**
* Determine if enable menu bind role.
*
* @return bool
*/
public static function withRole()
{
return (bool) config('store.permission.enable');
}
/**
* Detach models from the relationship.
*
* @return void
*/
protected static function boot()
{
static::treeBoot();
static::deleting(function ($model) {
$model->roles()->detach();
$model->permissions()->detach();
$model->flushCache();
});
static::saved(function ($model) {
$model->flushCache();
});
}
}
<?php
namespace App\Store\Models;
use Dcat\Admin\Admin;
use Illuminate\Support\Facades\Cache;
trait MenuCache
{
protected $cacheKey = 'store_dcat-admin-menus-%d-%s';
/**
* Get an item from the cache, or execute the given Closure and store the result.
*
* @param \Closure $builder
* @return mixed
*/
protected function remember(\Closure $builder)
{
if (! $this->enableCache()) {
return $builder();
}
return $this->getStore()->remember($this->getCacheKey(), null, $builder);
}
/**
* @return bool|void
*/
public function flushCache()
{
if (! $this->enableCache()) {
return;
}
return $this->getStore()->delete($this->getCacheKey());
}
/**
* @return string
*/
protected function getCacheKey()
{
return sprintf($this->cacheKey, (int) static::withPermission(), Admin::app()->getName());
}
/**
* @return bool
*/
public function enableCache()
{
return config('store.menu.cache.enable');
}
/**
* Get cache store.
*
* @return \Illuminate\Contracts\Cache\Repository
*/
public function getStore()
{
return Cache::store(config('store.menu.cache.store', 'file'));
}
}
<?php
namespace App\Store\Models;
use Dcat\Admin\Support\Helper;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Dcat\Admin\Traits\ModelTree;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Spatie\EloquentSortable\Sortable;
class Permission extends Model implements Sortable
{
use HasDateTimeFormatter,
ModelTree {
ModelTree::boot as treeBoot;
}
/**
* @var array
*/
protected $fillable = ['parent_id', 'name', 'slug', 'http_method', 'http_path'];
/**
* @var array
*/
public static $httpMethods = [
'GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'HEAD',
];
protected $titleColumn = 'name';
/**
* {@inheritDoc}
*/
public function __construct(array $attributes = [])
{
$this->init();
parent::__construct($attributes);
}
protected function init()
{
$connection = config('store.database.connection') ?: config('database.default');
$this->setConnection($connection);
$this->setTable(config('store.database.permissions_table'));
}
/**
* Permission belongs to many roles.
*
* @return BelongsToMany
*/
public function roles(): BelongsToMany
{
$pivotTable = config('store.database.role_permissions_table');
$relatedModel = config('store.database.roles_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'permission_id', 'role_id');
}
/**
* @return BelongsToMany
*/
public function menus(): BelongsToMany
{
$pivotTable = config('store.database.permission_menu_table');
$relatedModel = config('store.database.menu_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'permission_id', 'menu_id')->withTimestamps();
}
/**
* If request should pass through the current permission.
*
* @param Request $request
* @return bool
*/
public function shouldPassThrough(Request $request): bool
{
if (! $this->http_path) {
return false;
}
$method = $this->http_method;
$matches = array_map(function ($path) use ($method) {
if (Str::contains($path, ':')) {
[$method, $path] = explode(':', $path);
$method = explode(',', $method);
}
$path = Str::contains($path, '.') ? $path : ltrim(admin_base_path($path), '/');
return compact('method', 'path');
}, $this->http_path);
foreach ($matches as $match) {
if ($this->matchRequest($match, $request)) {
return true;
}
}
return false;
}
/**
* Get options for Select field in form.
*
* @param \Closure|null $closure
* @return array
*/
public static function selectOptions(\Closure $closure = null)
{
$options = (new static())->withQuery($closure)->buildSelectOptions();
return collect($options)->all();
}
/**
* @param string $path
* @return mixed
*/
public function getHttpPathAttribute($path)
{
return explode(',', $path);
}
/**
* @param $path
*/
public function setHttpPathAttribute($path)
{
if (is_array($path)) {
$path = implode(',', $path);
}
return $this->attributes['http_path'] = $path;
}
/**
* If a request match the specific HTTP method and path.
*
* @param array $match
* @param Request $request
* @return bool
*/
protected function matchRequest(array $match, Request $request): bool
{
if (! $path = trim($match['path'], '/')) {
return false;
}
if (! Helper::matchRequestPath($path, $request->decodedPath())) {
return false;
}
$method = collect($match['method'])->filter()->map(function ($method) {
return strtoupper($method);
});
return $method->isEmpty() || $method->contains($request->method());
}
/**
* @param $method
*/
public function setHttpMethodAttribute($method)
{
if (is_array($method)) {
$this->attributes['http_method'] = implode(',', $method);
}
}
/**
* @param $method
* @return array
*/
public function getHttpMethodAttribute($method)
{
if (is_string($method)) {
return array_filter(explode(',', $method));
}
return $method;
}
/**
* Detach models from the relationship.
*
* @return void
*/
protected static function boot()
{
static::treeBoot();
parent::boot();
static::deleting(function ($model) {
$model->roles()->detach();
});
}
}
<?php
namespace App\Store\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Role extends Model
{
use HasDateTimeFormatter;
const ADMINISTRATOR = 'administrator';
const ADMINISTRATOR_ID = 1;
protected $fillable = ['name', 'slug'];
/**
* {@inheritDoc}
*/
public function __construct(array $attributes = [])
{
$this->init();
parent::__construct($attributes);
}
protected function init()
{
$connection = config('store.database.connection') ?: config('database.default');
$this->setConnection($connection);
$this->setTable(config('store.database.roles_table'));
}
/**
* A role belongs to many users.
*
* @return BelongsToMany
*/
public function administrators(): BelongsToMany
{
$pivotTable = config('store.database.role_users_table');
$relatedModel = config('store.database.users_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'role_id', 'user_id');
}
/**
* A role belongs to many permissions.
*
* @return BelongsToMany
*/
public function permissions(): BelongsToMany
{
$pivotTable = config('store.database.role_permissions_table');
$relatedModel = config('store.database.permissions_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'role_id', 'permission_id')->withTimestamps();
}
/**
* @return BelongsToMany
*/
public function menus(): BelongsToMany
{
$pivotTable = config('store.database.role_menu_table');
$relatedModel = config('store.database.menu_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'role_id', 'menu_id')->withTimestamps();
}
/**
* Check user has permission.
*
* @param $permission
* @return bool
*/
public function can(?string $permission): bool
{
return $this->permissions()->where('slug', $permission)->exists();
}
/**
* Check user has no permission.
*
* @param $permission
* @return bool
*/
public function cannot(?string $permission): bool
{
return ! $this->can($permission);
}
/**
* Get id of the permission by id.
*
* @param array $roleIds
* @return \Illuminate\Support\Collection
*/
public static function getPermissionId(array $roleIds)
{
if (! $roleIds) {
return collect();
}
$related = config('store.database.role_permissions_table');
$model = new static();
$keyName = $model->getKeyName();
return $model->newQuery()
->leftJoin($related, $keyName, '=', 'role_id')
->whereIn($keyName, $roleIds)
->get(['permission_id', 'role_id'])
->groupBy('role_id')
->map(function ($v) {
$v = $v instanceof Arrayable ? $v->toArray() : $v;
return array_column($v, 'permission_id');
});
}
/**
* @param string $slug
* @return bool
*/
public static function isAdministrator(?string $slug)
{
return $slug === static::ADMINISTRATOR;
}
/**
* Detach models from the relationship.
*
* @return void
*/
protected static function boot()
{
parent::boot();
static::deleting(function ($model) {
$model->administrators()->detach();
$model->permissions()->detach();
});
}
}
<?php
namespace App\Store\Models;
use Illuminate\Database\Eloquent\Model;
class Setting extends Model
{
protected $primaryKey = 'slug';
public $incrementing = false;
protected $fillable = ['slug', 'value'];
/**
* {@inheritDoc}
*/
public function __construct(array $attributes = [])
{
$this->init();
parent::__construct($attributes);
}
protected function init()
{
$connection = config('store.database.connection') ?: config('database.default');
$this->setConnection($connection);
$this->setTable(config('store.database.settings_table') ?: 'admin_settings');
}
}
<?php
use Dcat\Admin\Admin;
use Dcat\Admin\Grid;
use Dcat\Admin\Form;
use Dcat\Admin\Grid\Filter;
use Dcat\Admin\Show;
use Dcat\Admin\Form\Field\Editor;
use Dcat\Admin\Support\JavaScript;
Editor::resolving(function (Editor $editor) {
// 设置默认配置
$editor->options([
'toolbar' => [
'code undo redo restoredraft | cut copy paste pastetext | forecolor backcolor bold italic underline strikethrough link anchor | alignleft aligncenter alignright alignjustify outdent indent | formatselect fontselect fontsizeselect | bullist numlist | blockquote subscript superscript removeformat | table image media charmap emoticons hr pagebreak insertdatetime print preview | fullscreen | bdmap indent2em lineheight formatpainter axupimgs',
],
'setup' => JavaScript::make(
<<<JS
function (editor) {
//console.log('编辑器初始化成功', editor)
}
JS
),
]);
// 设置编辑器图片默认上传到七牛云
//$editor->disk('img_oss');
});
/**
* 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');
*
*/
<?php
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Dcat\Admin\Admin;
Admin::routes();
Route::group([
'prefix' => config('admin.route.prefix'),
'namespace' => config('admin.route.namespace'),
'middleware' => config('admin.route.middleware'),
], function (Router $router) {
$router->match(['put', 'post'], 'upload/store', 'UploadFileController@storeUpload');
$router->match(['put', 'post'], 'upload/store-invoice', 'UploadFileController@storeInvoiceUpload');
$router->get('/', 'HomeController@index');
$router->resource('category', 'StoreGoodsCategoryController'); //商品分类管理
$router->resource('tag', 'StoreGoodsTagController'); //商品标签管理
$router->resource('goods', 'StoreGoodController'); //商品管理
$router->resource('order', 'StoreOrderController'); //订单管理
$router->resource('income', 'StoreIncomeController'); //提现管理
});
<?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;
<?php
return [
/*
|--------------------------------------------------------------------------
| dcat-admin name
|--------------------------------------------------------------------------
|
| This value is the name of dcat-admin, This setting is displayed on the
| login page.
|
*/
'name' => '律所管理系统',
/*
|--------------------------------------------------------------------------
| dcat-admin logo
|--------------------------------------------------------------------------
|
| The logo of all admin pages. You can also set it as an image by using a
| `img` tag, eg '<img src="http://logo-url" alt="Admin logo">'.
|
*/
'logo' => '<img src="/vendor/dcat-admin/images/logo.jpg" width="40"> &nbsp;律所管理系统',
/*
|--------------------------------------------------------------------------
| dcat-admin mini logo
|--------------------------------------------------------------------------
|
| The logo of all admin pages when the sidebar menu is collapsed. You can
| also set it as an image by using a `img` tag, eg
| '<img src="http://logo-url" alt="Admin logo">'.
|
*/
'logo-mini' => '<img src="/vendor/dcat-admin/images/logo.jpg">',
/*
|--------------------------------------------------------------------------
| dcat-admin favicon
|--------------------------------------------------------------------------
|
*/
'favicon' => '/vendor/dcat-admin/images/logo.jpg',
/*
|--------------------------------------------------------------------------
| User default avatar
|--------------------------------------------------------------------------
|
| Set a default avatar for newly created users.
|
*/
'default_avatar' => '@admin/images/default-avatar.jpg',
/*
|--------------------------------------------------------------------------
| dcat-admin route settings
|--------------------------------------------------------------------------
|
| The routing configuration of the admin page, including the path prefix,
| the controller namespace, and the default middleware. If you want to
| access through the root path, just set the prefix to empty string.
|
*/
'route' => [
'domain' => env('ADMIN_ROUTE_DOMAIN'),
'prefix' => '',
'namespace' => 'App\\Admin\\Controllers',
'middleware' => ['web', 'admin'],
'enable_session_middleware' => false,
],
/*
|--------------------------------------------------------------------------
| dcat-admin install directory
|--------------------------------------------------------------------------
|
| The installation directory of the controller and routing configuration
| files of the administration page. The default is `app/Admin`, which must
| be set before running `artisan admin::install` to take effect.
|
*/
'directory' => app_path('Admin'),
/*
|--------------------------------------------------------------------------
| dcat-admin html title
|--------------------------------------------------------------------------
|
| Html title for all pages.
|
*/
'title' => '律所管理系统',
/*
|--------------------------------------------------------------------------
| Assets hostname
|--------------------------------------------------------------------------
|
*/
'assets_server' => env('ADMIN_ASSETS_SERVER'),
/*
|--------------------------------------------------------------------------
| Access via `https`
|--------------------------------------------------------------------------
|
| If your page is going to be accessed via https, set it to `true`.
|
*/
'https' => env('ADMIN_HTTPS', false),
/*
|--------------------------------------------------------------------------
| dcat-admin auth setting
|--------------------------------------------------------------------------
|
| Authentication settings for all admin pages. Include an authentication
| guard and a user provider setting of authentication driver.
|
| You can specify a controller for `login` `logout` and other auth routes.
|
*/
'auth' => [
'enable' => true,
'controller' => App\Admin\Controllers\AuthController::class,
'guard' => 'admin',
'guards' => [
'admin' => [
'driver' => 'session',
'provider' => 'admin',
],
],
'providers' => [
'admin' => [
'driver' => 'eloquent',
'model' => Dcat\Admin\Models\Administrator::class,
],
],
// Add "remember me" to login form
'remember' => true,
// All method to path like: auth/users/*/edit
// or specific method to path like: get:auth/users.
'except' => [
'auth/login',
'auth/logout',
],
'enable_session_middleware' => false,
],
/*
|--------------------------------------------------------------------------
| The global Grid setting
|--------------------------------------------------------------------------
*/
'grid' => [
// The global Grid action display class.
'grid_action_class' => Dcat\Admin\Grid\Displayers\DropdownActions::class,
// The global Grid batch action display class.
'batch_action_class' => Dcat\Admin\Grid\Tools\BatchActions::class,
// The global Grid pagination display class.
'paginator_class' => Dcat\Admin\Grid\Tools\Paginator::class,
'actions' => [
'view' => Dcat\Admin\Grid\Actions\Show::class,
'edit' => Dcat\Admin\Grid\Actions\Edit::class,
'quick_edit' => Dcat\Admin\Grid\Actions\QuickEdit::class,
'delete' => Dcat\Admin\Grid\Actions\Delete::class,
'batch_delete' => Dcat\Admin\Grid\Tools\BatchDelete::class,
],
// The global Grid column selector setting.
'column_selector' => [
'store' => Dcat\Admin\Grid\ColumnSelector\SessionStore::class,
'store_params' => [
'driver' => 'file',
],
],
],
/*
|--------------------------------------------------------------------------
| dcat-admin helpers setting.
|--------------------------------------------------------------------------
*/
'helpers' => [
'enable' => true,
],
/*
|--------------------------------------------------------------------------
| dcat-admin permission setting
|--------------------------------------------------------------------------
|
| Permission settings for all admin pages.
|
*/
'permission' => [
// Whether enable permission.
'enable' => true,
// All method to path like: auth/users/*/edit
// or specific method to path like: get:auth/users.
'except' => [
'/',
'auth/login',
'auth/logout',
'auth/setting',
],
],
/*
|--------------------------------------------------------------------------
| dcat-admin menu setting
|--------------------------------------------------------------------------
|
*/
'menu' => [
'cache' => [
// enable cache or not
'enable' => false,
'store' => 'file',
],
// Whether enable menu bind to a permission.
'bind_permission' => true,
// Whether enable role bind to menu.
'role_bind_menu' => true,
// Whether enable permission bind to menu.
'permission_bind_menu' => true,
'default_icon' => 'feather icon-circle',
],
/*
|--------------------------------------------------------------------------
| dcat-admin upload setting
|--------------------------------------------------------------------------
|
| File system configuration for form upload files and images, including
| disk and upload path.
|
*/
'upload' => [
// Disk in `config/filesystem.php`.
'disk' => 'public',
// Image and file upload path under the disk above.
'directory' => [
'image' => 'images',
'file' => 'files',
],
],
/*
|--------------------------------------------------------------------------
| dcat-admin database settings
|--------------------------------------------------------------------------
|
| Here are database settings for dcat-admin builtin model & tables.
|
*/
'database' => [
// Database connection for following tables.
'connection' => '',
// User tables and model.
'users_table' => 'admin_users',
'users_model' => Dcat\Admin\Models\Administrator::class,
// Role table and model.
'roles_table' => 'admin_roles',
'roles_model' => Dcat\Admin\Models\Role::class,
// Permission table and model.
'permissions_table' => 'admin_permissions',
'permissions_model' => Dcat\Admin\Models\Permission::class,
// Menu table and model.
'menu_table' => 'admin_menu',
'menu_model' => Dcat\Admin\Models\Menu::class,
// Pivot table for table above.
'role_users_table' => 'admin_role_users',
'role_permissions_table' => 'admin_role_permissions',
'role_menu_table' => 'admin_role_menu',
'permission_menu_table' => 'admin_permission_menu',
'settings_table' => 'admin_settings',
'extensions_table' => 'admin_extensions',
'extension_histories_table' => 'admin_extension_histories',
],
/*
|--------------------------------------------------------------------------
| Application layout
|--------------------------------------------------------------------------
|
| This value is the layout of admin pages.
*/
'layout' => [
// default, blue, blue-light, green
'color' => 'default',
// sidebar-separate
'body_class' => [],
'horizontal_menu' => false,
'sidebar_collapsed' => false,
// light, primary, dark
'sidebar_style' => 'light',
'dark_mode_switch' => false,
// bg-primary, bg-info, bg-warning, bg-success, bg-danger, bg-dark
'navbar_color' => '',
],
/*
|--------------------------------------------------------------------------
| The exception handler class
|--------------------------------------------------------------------------
|
*/
'exception_handler' => Dcat\Admin\Exception\Handler::class,
/*
|--------------------------------------------------------------------------
| Enable default breadcrumb
|--------------------------------------------------------------------------
|
| Whether enable default breadcrumb for every page content.
*/
'enable_default_breadcrumb' => true,
/*
|--------------------------------------------------------------------------
| Extension
|--------------------------------------------------------------------------
*/
'extension' => [
// When you use command `php artisan admin:ext-make` to generate extensions,
// the extension files will be generated in this directory.
'dir' => base_path('dcat-admin-extensions'),
],
];
<?php
use Illuminate\Support\Facades\Facade;
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL'),
/*
|--------------------------------------------------------------------------
| 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' => 'Asia/Shanghai',
/*
|--------------------------------------------------------------------------
| 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' => 'zh_CN',
/*
|--------------------------------------------------------------------------
| 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' => 'zh_CN',
/*
|--------------------------------------------------------------------------
| 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',
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => 'file',
// 'store' => 'redis',
],
/*
|--------------------------------------------------------------------------
| 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...
*/
Maatwebsite\Excel\ExcelServiceProvider::class,
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Jacobcyl\AliOSS\AliOssServiceProvider::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' => Facade::defaultAliases()->merge([
// 'ExampleClass' => App\Example\ExampleClass::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
])->toArray(),
];
<?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"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];
<?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", "ably", "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' => [
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'),
'encrypted' => true,
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
],
'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
],
'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.
|
*/
'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.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
'lock_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',
'lock_connection' => 'default',
],
'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'),
],
'octane' => [
'driver' => 'octane',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
| stores there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'search_path' => '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,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];
<?php
use Maatwebsite\Excel\Excel;
return [
'exports' => [
/*
|--------------------------------------------------------------------------
| Chunk size
|--------------------------------------------------------------------------
|
| When using FromQuery, the query is automatically chunked.
| Here you can specify how big the chunk should be.
|
*/
'chunk_size' => 1000,
/*
|--------------------------------------------------------------------------
| Pre-calculate formulas during export
|--------------------------------------------------------------------------
*/
'pre_calculate_formulas' => false,
/*
|--------------------------------------------------------------------------
| Enable strict null comparison
|--------------------------------------------------------------------------
|
| When enabling strict null comparison empty cells ('') will
| be added to the sheet.
*/
'strict_null_comparison' => false,
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV exports.
|
*/
'csv' => [
'delimiter' => ',',
'enclosure' => '"',
'line_ending' => PHP_EOL,
'use_bom' => false,
'include_separator_line' => false,
'excel_compatibility' => false,
'output_encoding' => '',
'test_auto_detect' => true,
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
],
'imports' => [
/*
|--------------------------------------------------------------------------
| Read Only
|--------------------------------------------------------------------------
|
| When dealing with imports, you might only be interested in the
| data that the sheet exists. By default we ignore all styles,
| however if you want to do some logic based on style data
| you can enable it by setting read_only to false.
|
*/
'read_only' => true,
/*
|--------------------------------------------------------------------------
| Ignore Empty
|--------------------------------------------------------------------------
|
| When dealing with imports, you might be interested in ignoring
| rows that have null values or empty strings. By default rows
| containing empty strings or empty values are not ignored but can be
| ignored by enabling the setting ignore_empty to true.
|
*/
'ignore_empty' => false,
/*
|--------------------------------------------------------------------------
| Heading Row Formatter
|--------------------------------------------------------------------------
|
| Configure the heading row formatter.
| Available options: none|slug|custom
|
*/
'heading_row' => [
'formatter' => 'slug',
],
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV imports.
|
*/
'csv' => [
'delimiter' => null,
'enclosure' => '"',
'escape_character' => '\\',
'contiguous' => false,
'input_encoding' => 'UTF-8',
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
],
/*
|--------------------------------------------------------------------------
| Extension detector
|--------------------------------------------------------------------------
|
| Configure here which writer/reader type should be used when the package
| needs to guess the correct type based on the extension alone.
|
*/
'extension_detector' => [
'xlsx' => Excel::XLSX,
'xlsm' => Excel::XLSX,
'xltx' => Excel::XLSX,
'xltm' => Excel::XLSX,
'xls' => Excel::XLS,
'xlt' => Excel::XLS,
'ods' => Excel::ODS,
'ots' => Excel::ODS,
'slk' => Excel::SLK,
'xml' => Excel::XML,
'gnumeric' => Excel::GNUMERIC,
'htm' => Excel::HTML,
'html' => Excel::HTML,
'csv' => Excel::CSV,
'tsv' => Excel::TSV,
/*
|--------------------------------------------------------------------------
| PDF Extension
|--------------------------------------------------------------------------
|
| Configure here which Pdf driver should be used by default.
| Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF
|
*/
'pdf' => Excel::DOMPDF,
],
/*
|--------------------------------------------------------------------------
| Value Binder
|--------------------------------------------------------------------------
|
| PhpSpreadsheet offers a way to hook into the process of a value being
| written to a cell. In there some assumptions are made on how the
| value should be formatted. If you want to change those defaults,
| you can implement your own default value binder.
|
| Possible value binders:
|
| [x] Maatwebsite\Excel\DefaultValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\StringValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder::class
|
*/
'value_binder' => [
'default' => Maatwebsite\Excel\DefaultValueBinder::class,
],
'cache' => [
/*
|--------------------------------------------------------------------------
| Default cell caching driver
|--------------------------------------------------------------------------
|
| By default PhpSpreadsheet keeps all cell values in memory, however when
| dealing with large files, this might result into memory issues. If you
| want to mitigate that, you can configure a cell caching driver here.
| When using the illuminate driver, it will store each value in the
| cache store. This can slow down the process, because it needs to
| store each value. You can use the "batch" store if you want to
| only persist to the store when the memory limit is reached.
|
| Drivers: memory|illuminate|batch
|
*/
'driver' => 'memory',
/*
|--------------------------------------------------------------------------
| Batch memory caching
|--------------------------------------------------------------------------
|
| When dealing with the "batch" caching driver, it will only
| persist to the store when the memory limit is reached.
| Here you can tweak the memory limit to your liking.
|
*/
'batch' => [
'memory_limit' => 60000,
],
/*
|--------------------------------------------------------------------------
| Illuminate cache
|--------------------------------------------------------------------------
|
| When using the "illuminate" caching driver, it will automatically use
| your default cache store. However if you prefer to have the cell
| cache on a separate store, you can configure the store name here.
| You can use any store defined in your cache config. When leaving
| at "null" it will use the default store.
|
*/
'illuminate' => [
'store' => null,
],
],
/*
|--------------------------------------------------------------------------
| Transaction Handler
|--------------------------------------------------------------------------
|
| By default the import is wrapped in a transaction. This is useful
| for when an import may fail and you want to retry it. With the
| transactions, the previous import gets rolled-back.
|
| You can disable the transaction handler by setting this to null.
| Or you can choose a custom made transaction handler here.
|
| Supported handlers: null|db
|
*/
'transactions' => [
'handler' => 'db',
'db' => [
'connection' => null,
],
],
'temporary_files' => [
/*
|--------------------------------------------------------------------------
| Local Temporary Path
|--------------------------------------------------------------------------
|
| When exporting and importing files, we use a temporary file, before
| storing reading or downloading. Here you can customize that path.
|
*/
'local_path' => storage_path('framework/cache/laravel-excel'),
/*
|--------------------------------------------------------------------------
| Remote Temporary Disk
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup with queues in which you
| cannot rely on having a shared local temporary path, you might
| want to store the temporary file on a shared disk. During the
| queue executing, we'll retrieve the temporary file from that
| location instead. When left to null, it will always use
| the local path. This setting only has effect when using
| in conjunction with queued imports and exports.
|
*/
'remote_disk' => null,
'remote_prefix' => null,
/*
|--------------------------------------------------------------------------
| Force Resync
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup as above, it's possible
| for the clean up that occurs after entire queue has been run to only
| cleanup the server that the last AfterImportJob runs on. The rest of the server
| would still have the local temporary file stored on it. In this case your
| local storage limits can be exceeded and future imports won't be processed.
| To mitigate this you can set this config value to be true, so that after every
| queued chunk is processed the local temporary file is deleted on the server that
| processed it.
|
*/
'force_resync_remote' => null,
],
];
<?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_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| 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 set up for each driver as an example of the required values.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'throw' => false,
],
'public_oss'=>[
'driver' => 'oss',
'access_id' => env('OSS_ACCESS_KEY_ID'),//Your Aliyun OSS AccessKeyId
'access_key' => env('OSS_ACCESS_KEY_SECRET'),//Your Aliyun OSS AccessKeySecret
'bucket' => env('OSS_PUBLIC_BUCKET'),//OSS bucket name
'endpoint' => env('OSS_ENDPOINT'),
'ssl' => false,
'debug' => true,
],
'admin' => [
'driver' => 'local',
'root' => public_path('uploads'),
'visibility' => 'public',
'url' => env('IMAGE_URL','http://pz.cc'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];
<?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' => 65536,
'threads' => 1,
'time' => 4,
],
];
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => false,
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array", "failover"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 90,
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90,
'block_for' => null,
'after_commit' => false,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];
<?php
use Laravel\Sanctum\Sanctum;
return [
/*
|--------------------------------------------------------------------------
| Stateful Domains
|--------------------------------------------------------------------------
|
| Requests from the following domains / hosts will receive stateful API
| authentication cookies. Typically, these should include your local
| and production domains which access your API via a frontend SPA.
|
*/
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
'%s%s',
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
Sanctum::currentApplicationUrlWithPort()
))),
/*
|--------------------------------------------------------------------------
| Sanctum Guards
|--------------------------------------------------------------------------
|
| This array contains the authentication guards that will be checked when
| Sanctum is trying to authenticate a request. If none of these guards
| are able to authenticate the request, Sanctum will use the bearer
| token that's present on an incoming request for authentication.
|
*/
'guard' => ['web'],
/*
|--------------------------------------------------------------------------
| Expiration Minutes
|--------------------------------------------------------------------------
|
| This value controls the number of minutes until an issued token will be
| considered expired. If this value is null, personal access tokens do
| not expire. This won't tweak the lifetime of first-party sessions.
|
*/
'expiration' => null,
/*
|--------------------------------------------------------------------------
| Sanctum Middleware
|--------------------------------------------------------------------------
|
| When authenticating your first-party SPA with Sanctum you may need to
| customize some of the middleware Sanctum uses while processing the
| request. You may change the middleware listed below as required.
|
*/
'middleware' => [
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
'scheme' => 'https',
],
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
];
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" since this is a secure default value.
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => 'lax',
];
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAdminTables extends Migration
{
public function getConnection()
{
return $this->config('database.connection') ?: config('database.default');
}
public function config($key)
{
return config('admin.'.$key);
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create($this->config('database.users_table'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('username', 120)->unique();
$table->string('password', 80);
$table->string('name');
$table->string('avatar')->nullable();
$table->string('remember_token', 100)->nullable();
$table->timestamps();
});
Schema::create($this->config('database.roles_table'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name', 50);
$table->string('slug', 50)->unique();
$table->timestamps();
});
Schema::create($this->config('database.permissions_table'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name', 50);
$table->string('slug', 50)->unique();
$table->string('http_method')->nullable();
$table->text('http_path')->nullable();
$table->integer('order')->default(0);
$table->bigInteger('parent_id')->default(0);
$table->timestamps();
});
Schema::create($this->config('database.menu_table'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('parent_id')->default(0);
$table->integer('order')->default(0);
$table->string('title', 50);
$table->string('icon', 50)->nullable();
$table->string('uri', 50)->nullable();
$table->timestamps();
});
Schema::create($this->config('database.role_users_table'), function (Blueprint $table) {
$table->bigInteger('role_id');
$table->bigInteger('user_id');
$table->unique(['role_id', 'user_id']);
$table->timestamps();
});
Schema::create($this->config('database.role_permissions_table'), function (Blueprint $table) {
$table->bigInteger('role_id');
$table->bigInteger('permission_id');
$table->unique(['role_id', 'permission_id']);
$table->timestamps();
});
Schema::create($this->config('database.role_menu_table'), function (Blueprint $table) {
$table->bigInteger('role_id');
$table->bigInteger('menu_id');
$table->unique(['role_id', 'menu_id']);
$table->timestamps();
});
Schema::create($this->config('database.permission_menu_table'), function (Blueprint $table) {
$table->bigInteger('permission_id');
$table->bigInteger('menu_id');
$table->unique(['permission_id', 'menu_id']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists($this->config('database.users_table'));
Schema::dropIfExists($this->config('database.roles_table'));
Schema::dropIfExists($this->config('database.permissions_table'));
Schema::dropIfExists($this->config('database.menu_table'));
Schema::dropIfExists($this->config('database.role_users_table'));
Schema::dropIfExists($this->config('database.role_permissions_table'));
Schema::dropIfExists($this->config('database.role_menu_table'));
Schema::dropIfExists($this->config('database.permission_menu_table'));
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAdminSettingsTable extends Migration
{
public function getConnection()
{
return $this->config('database.connection') ?: config('database.default');
}
public function config($key)
{
return config('admin.'.$key);
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create($this->config('database.settings_table') ?: 'admin_settings', function (Blueprint $table) {
$table->string('slug', 100)->primary();
$table->longText('value');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists($this->config('database.settings_table') ?: 'admin_settings');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAdminExtensionsTable extends Migration
{
public function getConnection()
{
return $this->config('database.connection') ?: config('database.default');
}
public function config($key)
{
return config('admin.'.$key);
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create($this->config('database.extensions_table') ?: 'admin_extensions', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->string('name', 100)->unique();
$table->string('version', 20)->default('');
$table->tinyInteger('is_enabled')->default(0);
$table->text('options')->nullable();
$table->timestamps();
$table->engine = 'InnoDB';
});
Schema::create($this->config('database.extension_histories_table') ?: 'admin_extension_histories', function (Blueprint $table) {
$table->bigIncrements('id')->unsigned();
$table->string('name', 100);
$table->tinyInteger('type')->default(1);
$table->string('version', 20)->default(0);
$table->text('detail')->nullable();
$table->index('name');
$table->timestamps();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists($this->config('database.extensions_table') ?: 'admin_extensions');
Schema::dropIfExists($this->config('database.extension_histories_table') ?: 'admin_extension_histories');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateAdminMenuTable extends Migration
{
public function getConnection()
{
return $this->config('database.connection') ?: config('database.default');
}
public function config($key)
{
return config('admin.'.$key);
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table($this->config('database.menu_table'), function (Blueprint $table) {
$table->tinyInteger('show')->default(1)->after('uri');
$table->string('extension', 50)->default('')->after('uri');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table($this->config('database.menu_table'), function (Blueprint $table) {
$table->dropColumn('show');
$table->dropColumn('extension');
});
}
}
<?php
return [
'scaffold' => [
'header' => 'Scaffold',
'choose' => 'choose',
'table' => 'Table',
'model' => 'Model',
'controller' => 'Controller',
'repository' => 'Repository',
'add_field' => 'Add field',
'pk' => 'Primary key',
'soft_delete' => 'Soft delete',
'create_migration' => 'Create migration',
'create_model' => 'Create model',
'create_repository' => 'Create repository',
'create_controller' => 'Create controller',
'run_migrate' => 'Run migrate',
'create_lang' => 'Create lang',
'field' => 'field',
'translation' => 'translation',
'comment' => 'comment',
'default' => 'default',
'field_name' => 'field name',
'type' => 'type',
'nullable' => 'nullable',
'key' => 'key',
'translate_title' => 'Translate Title',
'sync_translation_with_comment' => 'Sync translation and comment',
],
'client' => [
'delete_confirm' => 'Are you sure to delete this item ?',
'confirm' => 'Confirm',
'cancel' => 'Cancel',
'refresh_succeeded' => 'Refresh succeeded !',
'close' => 'Close',
'selected_options' => ':num options selected',
'exceed_max_item' => 'Maximum items exceeded.',
'no_preview' => 'No preview available.',
'500' => 'Internal server error !',
'403' => 'Permission deny !',
'401' => 'Unauthorized !',
'419' => 'Page expired !',
],
'online' => 'Online',
'login' => 'Login',
'logout' => 'Logout',
'setting' => 'Setting',
'name' => 'Name',
'username' => 'Username',
'user' => 'User',
'alias' => 'Alias',
'routes' => 'Routes',
'route_action' => 'Route Action',
'middleware' => 'Middleware',
'method' => 'Method',
'old_password' => 'Old password',
'password' => 'Password',
'password_confirmation' => 'Password confirmation',
'old_password_error' => 'Incorrect password',
'remember_me' => 'Remember me',
'user_setting' => 'User setting',
'avatar' => 'Avatar',
'list' => 'List',
'new' => 'New',
'create' => 'Create',
'delete' => 'Delete',
'remove' => 'Remove',
'edit' => 'Edit',
'quick_edit' => 'Quick Edit',
'view' => 'View',
'continue_editing' => 'Continue editing',
'continue_creating' => 'Continue creating',
'detail' => 'Detail',
'browse' => 'Browse',
'reset' => 'Reset',
'export' => 'Export',
'batch_delete' => 'Batch delete',
'save' => 'Save',
'refresh' => 'Refresh',
'order' => 'Order',
'expand' => 'Expand',
'collapse' => 'Collapse',
'filter' => 'Filter',
'search' => 'Search',
'close' => 'Close',
'show' => 'Show',
'entries' => 'entries',
'captcha' => 'Captcha',
'action' => 'Action',
'title' => 'Title',
'description' => 'Description',
'back' => 'Back',
'back_to_list' => 'Back to List',
'submit' => 'Submit',
'menu' => 'Menu',
'input' => 'Input',
'succeeded' => 'Succeeded',
'failed' => 'Failed',
'delete_confirm' => 'Are you sure to delete this item ?',
'delete_succeeded' => 'Delete succeeded !',
'delete_failed' => 'Delete failed !',
'update_succeeded' => 'Update succeeded !',
'update_failed' => 'Update failed !',
'save_succeeded' => 'Save succeeded !',
'save_failed' => 'Save failed !',
'refresh_succeeded' => 'Refresh succeeded !',
'login_successful' => 'Login successful',
'choose' => 'Choose',
'choose_file' => 'Select file',
'choose_image' => 'Select image',
'more' => 'More',
'deny' => 'Permission denied',
'administrator' => 'Administrator',
'no_data' => 'No data.',
'roles' => 'Roles',
'permissions' => 'Permissions',
'slug' => 'Slug',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
'alert' => 'Alert',
'parent_id' => 'Parent',
'icon' => 'Icon',
'uri' => 'URI',
'operation_log' => 'Operation log',
'parent_select_error' => 'Parent select error',
'tree' => 'Tree',
'table' => 'Table',
'default' => 'Default',
'import' => 'Import',
'is_not_import' => 'No',
'selected_options' => ':num options selected',
'pagination' => [
'range' => 'Showing :first to :last of :total entries',
],
'role' => 'Role',
'permission' => 'Permission',
'route' => 'Route',
'confirm' => 'Confirm',
'cancel' => 'Cancel',
'selectall' => 'Select all',
'http' => [
'method' => 'HTTP method',
'path' => 'HTTP path',
],
'all_methods_if_empty' => 'All methods if empty',
'all' => 'All',
'current_page' => 'Current page',
'selected_rows' => 'Selected rows',
'upload' => 'Upload',
'new_folder' => 'New folder',
'time' => 'Time',
'size' => 'Size',
'between_start' => 'Start',
'between_end' => 'End',
'next_page' => 'Next',
'prev_page' => 'Previous',
'next_step' => 'Next',
'prev_step' => 'Previous',
'done' => 'Done',
'listbox' => [
'text_total' => 'Showing all {0}',
'text_empty' => 'Empty list',
'filtered' => '{0} / {1}',
'filter_clear' => 'Show all',
'filter_placeholder' => 'Filter',
],
'responsive' => [
'display_all' => 'Display all',
'display' => 'Display',
'focus' => 'Focus',
],
'uploader' => [
'add_new_media' => 'Browse',
'drag_file' => 'Or drag file here',
'max_file_limit' => 'The :attribute may not be greater than :max.',
'exceed_size' => 'Exceeds the maximum file-size',
'interrupt' => 'Interrupt',
'upload_failed' => 'Upload failed! Please try again.',
'selected_files' => ':num files selected,size: :size。',
'selected_has_failed' => 'Uploaded: :success, failed: :fail, <a class="retry" href="javascript:"";">retry </a>or<a class="ignore" href="javascript:"";"> ignore</a>',
'selected_success' => ':num(:size) files selected, Uploaded: :success.',
'dot' => ', ',
'failed_num' => 'failed::fail.',
'pause_upload' => 'Pause',
'go_on_upload' => 'Go On',
'start_upload' => 'Upload',
'upload_success_message' => ':success files uploaded successfully',
'go_on_add' => 'New File',
'Q_TYPE_DENIED' => 'Sorry, the type of this file is not allowed!',
'Q_EXCEED_NUM_LIMIT' => 'Sorry, maximum number of allowable file uploads has been exceeded!',
'F_EXCEED_SIZE' => 'Sorry,the maximum file-size has been exceeded!',
'Q_EXCEED_SIZE_LIMIT' => 'Sorry, the maximum file-size has been exceeded!',
'F_DUPLICATE' => 'Duplicate file.',
'confirm_delete_file' => 'Are you sure delete this file from server?',
'dimensions' => 'The image dimensions is invalid.',
],
'import_extension_confirm' => 'Are you sure import the extension?',
'quick_create' => 'Quick create',
'grid_items_selected' => '{n} items selected',
'nothing_updated' => 'Nothing has been updated.',
'welcome_back' => 'Welcome back, please login to your account.',
'documentation' => 'Documentation',
'demo' => 'Demo',
'extensions' => 'Extensions',
'version' => 'Version',
'current_version' => 'Current version',
'latest_version' => 'Latest version',
'upgrade_to_version' => 'Upgrade to version :version',
'enable' => 'Enable',
'disable' => 'Disable',
'uninstall' => 'Uninstall',
'confirm_uninstall' => 'Please confirm that you wish to uninstall this extension. This may result in potential data loss.',
'marketplace' => 'Marketplace',
'theme' => 'Theme',
'application' => 'Application',
'install_from_local' => 'Install From Local',
'install_succeeded' => 'Install succeeded !',
'invalid_extension_package' => 'Invalid extension package !',
'copied' => 'Copied',
'auth_failed' => 'These credentials do not match our records.',
'validation' => [
'match' => 'The :attribute and :other must match.',
'minlength' => 'The :attribute must be at least :min characters.',
'maxlength' => 'The :attribute may not be greater than :max characters.',
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => 'These credentials do not match our records.',
'password' => 'The provided password is incorrect.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
'previous' => '&laquo; Previous',
'next' => 'Next &raquo;',
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
'reset' => 'Your password has been reset!',
'sent' => 'We have emailed your password reset link!',
'throttled' => 'Please wait before retrying.',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that email address.",
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
'accepted' => 'The :attribute must be accepted.',
'accepted_if' => 'The :attribute must be accepted when :other is :value.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
'alpha' => 'The :attribute must only contain letters.',
'alpha_dash' => 'The :attribute must only contain letters, numbers, dashes and underscores.',
'alpha_num' => 'The :attribute must only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'ascii' => 'The :attribute must only contain single-byte alphanumeric characters and symbols.',
'before' => 'The :attribute must be a date before :date.',
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
'between' => [
'array' => 'The :attribute must have between :min and :max items.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'numeric' => 'The :attribute must be between :min and :max.',
'string' => 'The :attribute must be between :min and :max characters.',
],
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'current_password' => 'The password is incorrect.',
'date' => 'The :attribute is not a valid date.',
'date_equals' => 'The :attribute must be a date equal to :date.',
'date_format' => 'The :attribute does not match the format :format.',
'decimal' => 'The :attribute must have :decimal decimal places.',
'declined' => 'The :attribute must be declined.',
'declined_if' => 'The :attribute must be declined when :other is :value.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'dimensions' => 'The :attribute has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'doesnt_end_with' => 'The :attribute may not end with one of the following: :values.',
'doesnt_start_with' => 'The :attribute may not start with one of the following: :values.',
'email' => 'The :attribute must be a valid email address.',
'ends_with' => 'The :attribute must end with one of the following: :values.',
'enum' => 'The selected :attribute is invalid.',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field must have a value.',
'gt' => [
'array' => 'The :attribute must have more than :value items.',
'file' => 'The :attribute must be greater than :value kilobytes.',
'numeric' => 'The :attribute must be greater than :value.',
'string' => 'The :attribute must be greater than :value characters.',
],
'gte' => [
'array' => 'The :attribute must have :value items or more.',
'file' => 'The :attribute must be greater than or equal to :value kilobytes.',
'numeric' => 'The :attribute must be greater than or equal to :value.',
'string' => 'The :attribute must be greater than or equal to :value characters.',
],
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field does not exist in :other.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'ipv4' => 'The :attribute must be a valid IPv4 address.',
'ipv6' => 'The :attribute must be a valid IPv6 address.',
'json' => 'The :attribute must be a valid JSON string.',
'lowercase' => 'The :attribute must be lowercase.',
'lt' => [
'array' => 'The :attribute must have less than :value items.',
'file' => 'The :attribute must be less than :value kilobytes.',
'numeric' => 'The :attribute must be less than :value.',
'string' => 'The :attribute must be less than :value characters.',
],
'lte' => [
'array' => 'The :attribute must not have more than :value items.',
'file' => 'The :attribute must be less than or equal to :value kilobytes.',
'numeric' => 'The :attribute must be less than or equal to :value.',
'string' => 'The :attribute must be less than or equal to :value characters.',
],
'mac_address' => 'The :attribute must be a valid MAC address.',
'max' => [
'array' => 'The :attribute must not have more than :max items.',
'file' => 'The :attribute must not be greater than :max kilobytes.',
'numeric' => 'The :attribute must not be greater than :max.',
'string' => 'The :attribute must not be greater than :max characters.',
],
'max_digits' => 'The :attribute must not have more than :max digits.',
'mimes' => 'The :attribute must be a file of type: :values.',
'mimetypes' => 'The :attribute must be a file of type: :values.',
'min' => [
'array' => 'The :attribute must have at least :min items.',
'file' => 'The :attribute must be at least :min kilobytes.',
'numeric' => 'The :attribute must be at least :min.',
'string' => 'The :attribute must be at least :min characters.',
],
'min_digits' => 'The :attribute must have at least :min digits.',
'missing' => 'The :attribute field must be missing.',
'missing_if' => 'The :attribute field must be missing when :other is :value.',
'missing_unless' => 'The :attribute field must be missing unless :other is :value.',
'missing_with' => 'The :attribute field must be missing when :values is present.',
'missing_with_all' => 'The :attribute field must be missing when :values are present.',
'multiple_of' => 'The :attribute must be a multiple of :value.',
'not_in' => 'The selected :attribute is invalid.',
'not_regex' => 'The :attribute format is invalid.',
'numeric' => 'The :attribute must be a number.',
'password' => [
'letters' => 'The :attribute must contain at least one letter.',
'mixed' => 'The :attribute must contain at least one uppercase and one lowercase letter.',
'numbers' => 'The :attribute must contain at least one number.',
'symbols' => 'The :attribute must contain at least one symbol.',
'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.',
],
'present' => 'The :attribute field must be present.',
'prohibited' => 'The :attribute field is prohibited.',
'prohibited_if' => 'The :attribute field is prohibited when :other is :value.',
'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.',
'prohibits' => 'The :attribute field prohibits :other from being present.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_array_keys' => 'The :attribute field must contain entries for: :values.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_if_accepted' => 'The :attribute field is required when :other is accepted.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values are present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'required_without_all' => 'The :attribute field is required when none of :values are present.',
'same' => 'The :attribute and :other must match.',
'size' => [
'array' => 'The :attribute must contain :size items.',
'file' => 'The :attribute must be :size kilobytes.',
'numeric' => 'The :attribute must be :size.',
'string' => 'The :attribute must be :size characters.',
],
'starts_with' => 'The :attribute must start with one of the following: :values.',
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid timezone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'uppercase' => 'The :attribute must be uppercase.',
'url' => 'The :attribute must be a valid URL.',
'ulid' => 'The :attribute must be a valid ULID.',
'uuid' => 'The :attribute must be a valid UUID.',
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
'custom' => [
'attribute-name' => [
'rule-name' => 'custom-message',
],
],
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap our attribute placeholder
| with something more reader friendly such as "E-Mail Address" instead
| of "email". This simply helps us make our message more expressive.
|
*/
'attributes' => [],
];
<?php
return [
'scaffold' => [
'header' => '代码生成器',
'choose' => '选择已有数据表',
'table' => '表名',
'model' => '模型',
'controller' => '控制器',
'repository' => '数据仓库',
'add_field' => '添加字段',
'pk' => '主键',
'soft_delete' => '软删除',
'create_migration' => '创建表迁移文件',
'create_model' => '创建模型',
'create_repository' => '创建数据仓库',
'create_controller' => '创建控制器',
'run_migrate' => '创建数据表',
'create_lang' => '创建翻译文件',
'field' => '字段',
'translation' => '翻译',
'comment' => '注释',
'default' => '默认值',
'field_name' => '字段名',
'type' => '类型',
'nullable' => '允许空值',
'key' => '索引',
'translate_title' => '翻译标题',
'sync_translation_with_comment' => '同步翻译与注释',
],
'client' => [
'delete_confirm' => '确认删除?',
'confirm' => '确认',
'cancel' => '取消',
'refresh_succeeded' => '刷新成功 !',
'submit' => '提交',
'close' => '关闭',
'selected_options' => '已选中:num个选项',
'exceed_max_item' => '已超出最大可选数量',
'no_preview' => '预览失败',
'500' => '系统繁忙,请稍后再试!',
'403' => '对不起,您没有权限访问,请与管理员联系。',
'401' => '请登录!',
'419' => '对不起,当前页面已失效,请刷新浏览器。',
],
'home' => '主页',
'online' => '在线',
'login' => '登录',
'logout' => '登出',
'setting' => '设置',
'name' => '名称',
'username' => '用户名',
'old_password' => '旧密码',
'password' => '密码',
'password_confirmation' => '确认密码',
'old_password_error' => '请输入正确的旧密码',
'remember_me' => '记住我',
'user_setting' => '用户设置',
'avatar' => '头像',
'list' => '列表',
'new' => '新增',
'create' => '创建',
'delete' => '删除',
'remove' => '移除',
'edit' => '编辑',
'quick_edit' => '快捷编辑',
'continue_editing' => '继续编辑',
'continue_creating' => '继续创建',
'view' => '查看',
'detail' => '详细',
'browse' => '浏览',
'reset' => '重置',
'export' => '导出',
'batch_delete' => '批量删除',
'save' => '保存',
'refresh' => '刷新',
'order' => '排序',
'expand' => '展开',
'collapse' => '收起',
'filter' => '筛选',
'search' => '搜索',
'close' => '关闭',
'show' => '显示',
'entries' => '条',
'captcha' => '验证码',
'action' => '操作',
'title' => '标题',
'description' => '简介',
'back' => '返回',
'back_to_list' => '返回列表',
'submit' => '提交',
'menu' => '菜单',
'input' => '输入',
'succeeded' => '成功',
'failed' => '失败',
'delete_confirm' => '确认删除?',
'delete_succeeded' => '删除成功 !',
'delete_failed' => '删除失败 !',
'update_succeeded' => '更新成功 !',
'update_failed' => '更新失败 !',
'save_succeeded' => '保存成功 !',
'save_failed' => '保存失败 !',
'refresh_succeeded' => '刷新成功 !',
'login_successful' => '登录成功 !',
'choose' => '选择',
'choose_file' => '选择文件',
'choose_image' => '选择图片',
'more' => '更多',
'deny' => '无权访问',
'administrator' => '管理员',
'roles' => '角色',
'permissions' => '权限',
'slug' => '标识',
'created_at' => '创建时间',
'updated_at' => '更新时间',
'alert' => '注意',
'parent_id' => '父级',
'icon' => '图标',
'uri' => '路径',
'operation_log' => '操作日志',
'parent_select_error' => '父级选择错误',
'default' => '默认',
'table' => '表格',
'no_data' => '暂无数据',
'routes' => '路由',
'alias' => '别名',
'route_action' => '处理器',
'middleware' => '中间件',
'import' => '导入',
'is_not_import' => '未导入',
'selected_options' => '已选中:num个选项',
'method' => '方法',
'user' => '用户',
'pagination' => [
'range' => '从 :first 到 :last ,总共 :total 条',
],
'role' => '角色',
'permission' => '权限',
'route' => '路由',
'confirm' => '确认',
'cancel' => '取消',
'selectall' => '全选',
'http' => [
'method' => 'HTTP方法',
'path' => 'HTTP路径',
],
'all_methods_if_empty' => '为空默认为所有方法',
'all' => '全部',
'current_page' => '当前页',
'selected_rows' => '选择的行',
'upload' => '上传',
'new_folder' => '新建文件夹',
'time' => '时间',
'size' => '大小',
'between_start' => '起始',
'between_end' => '结束',
'next_page' => '下一页',
'prev_page' => '上一页',
'next_step' => '下一步',
'prev_step' => '上一步',
'done' => '完成',
'listbox' => [
'text_total' => '总共 {0} 项',
'text_empty' => '空列表',
'filtered' => '{0} / {1}',
'filter_clear' => '显示全部',
'filter_placeholder' => '过滤',
],
'responsive' => [
'display_all' => '显示全部',
'display' => '字段',
'focus' => '聚焦',
],
'uploader' => [
'add_new_media' => '添加文件',
'drag_file' => '或将文件拖到这里',
'max_file_limit' => 'The :attribute may not be greater than :max.',
'exceed_size' => '文件大小超出',
'interrupt' => '上传暂停',
'upload_failed' => '上传失败,请重试',
'selected_files' => '选中:num个文件,共:size。',
'selected_has_failed' => '已成功上传:success个文件,:fail个文件上传失败,<a class="retry" href="javascript:"";">重新上传</a>失败文件或<a class="ignore" href="javascript:"";">忽略</a>',
'selected_success' => '共:num个(:size),已上传:success个。',
'dot' => ',',
'failed_num' => '失败:fail个。',
'pause_upload' => '暂停上传',
'go_on_upload' => '继续上传',
'start_upload' => '开始上传',
'upload_success_message' => '已成功上传:success个文件',
'go_on_add' => '继续添加',
'Q_TYPE_DENIED' => '对不起,不允许上传此类型文件',
'Q_EXCEED_NUM_LIMIT' => '对不起,已超出文件上传数量限制,最多只能上传:num个文件',
'F_EXCEED_SIZE' => '对不起,当前选择的文件过大',
'Q_EXCEED_SIZE_LIMIT' => '对不起,已超出文件大小限制',
'F_DUPLICATE' => '文件重复',
'confirm_delete_file' => '您确定要删除这个文件吗?',
'dimensions' => '图片规格不正确',
],
'import_extension_confirm' => '确认导入拓展?',
'quick_create' => '快速创建',
'grid_items_selected' => '已选择 {n} 项',
'nothing_updated' => '没有任何数据被更改',
'welcome_back' => '欢迎回来,请登录您的账号。',
'documentation' => '文档',
'demo' => '示例',
'extensions' => '扩展',
'version' => '版本',
'current_version' => '当前版本',
'latest_version' => '最新版本',
'upgrade_to_version' => '更新至版本 :version',
'enable' => '启用',
'disable' => '禁用',
'uninstall' => '卸载',
'confirm_uninstall' => '您确定要卸载当前扩展吗?此操作将会移除扩展数据!',
'marketplace' => '应用市场',
'theme' => '主题',
'application' => '应用',
'install_from_local' => '本地安装',
'install_succeeded' => '安装成功',
'invalid_extension_package' => '安装包异常',
'copied' => '已复制',
'auth_failed' => '账号或密码错误',
'validation' => [
'match' => '与 :attribute 不匹配。',
'minlength' => ':attribute 字符长度不能少于 :min。',
'maxlength' => ':attribute 字符长度不能超出 :max。',
],
];
<?php
return [
'labels' => [
'Carousel' => '轮播图',
'carousel' => '轮播图',
],
'fields' => [
'descr' => '描述',
'imgUrl' => '图片',
'linkUrl' => '链接',
'status' => '是否启用',
],
'options' => [
],
];
<?php
return [
'labels' => [
'Covenant' => '合同信息',
'covenant' => '合同信息',
],
'fields' => [
'number' => '合同编号',
'cname' => '合同名称',
'ctype' => '合同类型',
'sign_at' => '签订日期',
'principal_type' => '委托人类型',
'principal_id' => '委托人',
'principal' => '委托人',
'lawyer_id' => '办案律师',
'lawyer' => '办案律师',
'amount' => '合同金额',
'payment_method' => '结算方式',
'case_reason' => '案由',
],
'options' => [],
];
<?php
return [
'labels' => [
'Declaration' => '申报统计',
'declaration' => '申报统计',
],
'fields' => [],
'options' => [],
];
<?php
return [
'labels' => [
'Extensions' => '扩展',
],
'fields' => [
'alias' => '别名',
'description' => '描述',
'authors' => '开发者',
'homepage' => '主页',
'require' => '依赖',
'require_dev' => '开发环境依赖',
'name' => '包名',
'version' => '版本',
'enable' => '启用',
'config' => '配置',
'imported' => '导入',
],
'options' => [
],
];
<?php
return [
'fields' => [
'id' => 'ID',
'name' => '名称',
'username' => '用户名',
'email' => '邮箱',
'http_path' => 'HTTP路径',
'password' => '密码',
'password_confirmation' => '确认密码',
'created_at' => '创建时间',
'updated_at' => '更新时间',
'permissions' => '权限',
'slug' => '标识',
'user' => '用户',
'order' => '排序',
'ip' => 'IP',
'method' => '方法',
'uri' => 'URI',
'roles' => '角色',
'path' => '路径',
'input' => '输入',
'type' => '类型',
],
'labels' => [
'list' => '列表',
'edit' => '编辑',
'detail' => '详细',
'create' => '创建',
'root' => '顶级',
'scaffold' => '代码生成器',
'NdDempartApplyPer' => '各院系时年度申报率',
'dempartApplyPer' => '各院系时年度申报率',
],
'options' => [
//
],
];
<?php
return [
'labels' => [
'LawyerCostCollect' => '成本汇总',
'LawyerCostCollect' => '成本汇总',
],
'fields' => [
'year' => '年份',
'month' => '月份',
'number' => '律师编号',
'lname' => '律师姓名',
'basic_salary' => '基本工资',
'social_person_fee' => '社保个人部分',
'social_company_fee' => '社保单位部分',
'accumulation_fund_person_fee' => '公积金个人部分',
'accumulation_fund_company_fee' => '公积金单位部分',
'annual_inspection_fee' => '律师年检费',
'annuity' => '年金',
'office_rental_fee' => '办公室租赁成本',
'noticket_cost' => '无票成本',
'posting_tickets_fee' => '贴票成本',
'assistant_fee' => '助理律师成本',
'special_additional' => '专项附加',
'advance_fee' => '预支款',
'personal_income_tax' => '个人所得税',
'identity_card' => '身份证',
'phone' => '手机号',
],
'options' => [],
];
<?php
return [
'labels' => [
'LawyerCostList' => '成本明细',
'LawyerCostList' => '成本明细',
],
'fields' => [
'year' => '年份',
'month' => '月份',
'number' => '律师编号',
'lname' => '律师姓名',
'basic_salary' => '基本工资',
'social_person_fee' => '社保个人部分',
'social_company_fee' => '社保单位部分',
'accumulation_fund_person_fee' => '公积金个人部分',
'accumulation_fund_company_fee' => '公积金单位部分',
'annual_inspection_fee' => '律师年检费',
'annuity' => '年金',
'office_rental_fee' => '办公室租赁成本',
'noticket_cost' => '无票成本',
'posting_tickets_fee' => '贴票成本',
'assistant_fee' => '助理律师成本',
'special_additional' => '专项附加',
'advance_fee' => '预支款',
'personal_income_tax' => '个人所得税',
'identity_card' => '身份证',
'phone' => '手机号',
],
'options' => [],
];
<?php
return [
'labels' => [
'LawyerCost' => '律师成本',
'lawyer-cost' => '律师成本',
],
'fields' => [
'year' => '年份',
'month' => '月份',
'number' => '律师编号',
'lname' => '律师姓名',
'basic_salary' => '基本工资',
'social_person_fee' => '社保个人部分',
'social_company_fee' => '社保单位部分',
'accumulation_fund_person_fee' => '公积金个人部分',
'accumulation_fund_company_fee' => '公积金单位部分',
'annual_inspection_fee' => '律师年检费',
'annuity' => '年金',
'office_rental_fee' => '办公室租赁成本',
'noticket_cost' => '无票成本',
'posting_tickets_fee' => '贴票成本',
'assistant_fee' => '助理律师成本',
'special_additional' => '专项附加',
'advance_fee' => '预支款',
'personal_income_tax' => '个人所得税',
'identity_card' => '身份证',
'phone' => '手机号',
],
'options' => [],
];
<?php
return [
'labels' => [
'LawyerIncome' => '律师创收',
'lawyerIncome' => '律师创收',
],
'fields' => [
'number' => '律师编号',
'name' => '姓名',
'sex' => '性别',
'identity_card' => '身份证',
'phone' => '手机号',
'bank_account' => '银行卡',
'sign_at' => '签订合同时间',
'commission_rate' => '提成比例(%)',
'settlement_period' => '结算周期',
'settlement_method' => '结算方式',
],
'options' => [],
];
<?php
return [
'labels' => [
'Lawyer' => '律师信息',
'lawyer' => '律师信息',
],
'fields' => [
'number' => '律师编号',
'name' => '姓名',
'sex' => '性别',
'identity_card' => '身份证',
'phone' => '手机号',
'bank_account' => '银行卡',
'sign_at' => '签订合同时间',
'commission_rate' => '提成比例(%)',
'settlement_period' => '结算周期',
'settlement_method' => '结算方式',
],
'options' => [],
];
<?php
return [
'titles' => [
'index' => '主页',
'admin' => '系统',
'users' => '管理员',
'roles' => '角色',
'permission' => '权限',
'menu' => '菜单',
'operation_log' => '操作日志',
'helpers' => '开发工具',
'extensions' => '扩展',
'scaffold' => '代码生成器',
'icons' => '图标',
],
];
<?php
return [
'labels' => [
'Principal' => '委托人信息',
'principal' => '委托人信息',
],
'fields' => [
'number' => '委托人编号',
'company' => '单位全称',
'name' => '姓名',
'identity_card' => '身份证号码',
'tax_number' => '税号',
'address' => '通讯地址',
'tel' => '联系电话',
'bank_name' => '开会银行',
'bank_account' => '账号',
'contacts' => '单位联系人',
'phone' => '手机号',
],
'options' => [],
];
<?php
return [
'scaffold' => [
'header' => '代碼生成器',
'choose' => '選擇已有數據表',
'table' => '表名',
'model' => '模型',
'controller' => '控制器',
'repository' => '數據倉庫',
'add_field' => '添加欄位',
'pk' => '主鍵',
'soft_delete' => '軟刪除',
'create_migration' => '創建表遷移文件',
'create_model' => '創建模型',
'create_repository' => '創建數據倉庫',
'create_controller' => '創建控制器',
'run_migrate' => '創建數據表',
'create_lang' => '創建翻譯文件',
'field' => '欄位',
'translation' => '翻譯',
'comment' => '註解',
'default' => '預設值',
'field_name' => '欄位名',
'type' => '類型',
'nullable' => '允許null',
'key' => '索引',
'translate_title' => '翻譯標題',
'sync_translation_with_comment' => '同步翻譯與註釋',
],
'client' => [
'delete_confirm' => '確認刪除?',
'confirm' => '確認',
'cancel' => '取消',
'refresh_succeeded' => '刷新成功!',
'close' => '關閉',
'submit' => '提交',
'selected_options' => '已選中:num個選項',
'exceed_max_item' => '已超出最大可選數量',
'no_preview' => '預覽失敗',
'500' => '系統繁忙,請稍後再試!',
'403' => '對不起,您無訪問權限,請聯繫管理員。',
'401' => '請先登入!',
'419' => '對不起,當前頁面已失效,請刷新瀏覽器。',
],
'home' => '首頁',
'online' => '在線',
'login' => '登入',
'logout' => '登出',
'setting' => '設置',
'name' => '名稱',
'username' => '用戶名',
'old_password' => '舊密碼',
'password' => '密碼',
'password_confirmation' => '確認密碼',
'old_password_error' => '舊密碼輸入錯誤',
'remember_me' => '記住我',
'user_setting' => '用戶設置',
'avatar' => '頭像',
'list' => '列表',
'new' => '新增',
'create' => '創建',
'delete' => '刪除',
'remove' => '移除',
'edit' => '編輯',
'quick_edit' => '快速編輯',
'continue_editing' => '繼續編輯',
'continue_creating' => '繼續新增',
'view' => '查看',
'detail' => '詳細',
'browse' => '瀏覽',
'reset' => '重置',
'export' => '匯出',
'batch_delete' => '批次刪除',
'save' => '儲存',
'refresh' => '重新整理',
'order' => '排序',
'expand' => '展開',
'collapse' => '收起',
'filter' => '篩選',
'search' => '搜索',
'close' => '關閉',
'show' => '詳情',
'entries' => '條',
'captcha' => '驗證碼',
'action' => '操作',
'title' => '標題',
'description' => '簡介',
'back' => '返回',
'back_to_list' => '返回列表',
'submit' => '送出',
'menu' => '目錄',
'input' => '輸入',
'succeeded' => '成功',
'failed' => '失敗',
'delete_confirm' => '確認刪除?',
'delete_succeeded' => '刪除成功!',
'delete_failed' => '刪除失敗!',
'update_succeeded' => '更新成功!',
'update_failed' => '更新失敗 !',
'save_succeeded' => '儲存成功!',
'save_failed' => '儲存失敗 !',
'refresh_succeeded' => '刷新成功!',
'login_successful' => '登入成功!',
'choose' => '選擇',
'choose_file' => '選擇檔案',
'choose_image' => '選擇圖片',
'more' => '更多',
'deny' => '權限不足',
'administrator' => '管理員',
'roles' => '角色',
'permissions' => '權限',
'slug' => '標誌',
'created_at' => '建立時間',
'updated_at' => '更新時間',
'alert' => '警告',
'parent_id' => '父級',
'icon' => '圖示',
'uri' => '路徑',
'operation_log' => '操作記錄',
'parent_select_error' => '父級選擇錯誤',
'default' => '預設',
'table' => '表格',
'no_data' => '暫無數據',
'routes' => '路由',
'alias' => '別名',
'route_action' => '處理器',
'middleware' => '中間件',
'import' => '導入',
'is_not_import' => '未導入',
'selected_options' => '已選中:num個選項',
'method' => '方法',
'user' => '用戶',
'pagination' => [
'range' => '從 :first 到 :last ,總共 :total 條',
],
'role' => '角色',
'permission' => '權限',
'route' => '路由',
'confirm' => '確認',
'cancel' => '取消',
'selectall' => '全選',
'http' => [
'method' => 'HTTP方法',
'path' => 'HTTP路徑',
],
'all_methods_if_empty' => '所有方法預設為空',
'all' => '全部',
'current_page' => '現在頁面',
'selected_rows' => '選擇的行',
'upload' => '上傳',
'new_folder' => '新建資料夾',
'time' => '時間',
'size' => '大小',
'between_start' => '起始',
'between_end' => '結束',
'next_page' => '下一頁',
'prev_page' => '上一頁',
'next_step' => '下一步',
'prev_step' => '上一步',
'done' => '完成',
'listbox' => [
'text_total' => '總共 {0} 項',
'text_empty' => '空列表',
'filtered' => '{0} / {1}',
'filter_clear' => '顯示全部',
'filter_placeholder' => '過濾',
],
'responsive' => [
'display_all' => '顯示全部',
'display' => '欄位',
'focus' => '聚焦',
],
'uploader' => [
'add_new_media' => '添加檔案',
'drag_file' => '或將檔案拖移到這裡',
'max_file_limit' => ':attribute不能超過:max.',
'exceed_size' => '檔案大小過大',
'interrupt' => '暫停上傳',
'upload_failed' => '上傳失敗,請再試一次',
'selected_files' => '選中:num個檔案,共:size。',
'selected_has_failed' => '已成功上傳:success個檔案,:fail個檔案上傳失敗,<a class="retry" href="javascript:"";">重新上傳</a>失敗檔案或<a class="ignore" href="javascript:"";">忽略</a>',
'selected_success' => '共:num个(:size),已上傳:success個。',
'dot' => ',',
'failed_num' => '失敗:fail個。',
'pause_upload' => '暫停上傳',
'go_on_upload' => '繼續上傳',
'start_upload' => '開始上傳',
'upload_success_message' => '已成功上傳:success個檔案',
'go_on_add' => '繼續添加',
'Q_TYPE_DENIED' => '對不起,無法上傳該類型檔案',
'Q_EXCEED_NUM_LIMIT' => '对不起,超出上傳數量限制,最多只能上傳:num個檔案',
'F_EXCEED_SIZE' => '对不起,當前選擇的檔案過大',
'Q_EXCEED_SIZE_LIMIT' => '对不起,檔案大小超出限制',
'F_DUPLICATE' => '檔案重複',
'confirm_delete_file' => '您確定要刪除該檔案嗎?',
'dimensions' => '圖片規格不正確',
],
'import_extension_confirm' => '確認導入擴展?',
'quick_create' => '快速新增',
'grid_items_selected' => '已選擇 {n} 項',
'nothing_updated' => '沒有任何資料被更改',
'welcome_back' => '歡迎回來,請登入帳號',
'documentation' => '文檔',
'demo' => '範例',
'extensions' => '擴展',
'version' => '版本',
'current_version' => '当前版本',
'latest_version' => '當前版本',
'upgrade_to_version' => '更新至版本 :version',
'enable' => '啟用',
'disable' => '禁用',
'uninstall' => '卸載',
'confirm_uninstall' => '您確定要卸載當前擴展嗎?此操作將會移除擴展數據!',
'marketplace' => '應用市場',
'theme' => '主題',
'application' => '應用',
'install_from_local' => '本地安装',
'install_succeeded' => '本地安裝',
'invalid_extension_package' => '安裝包異常',
'copied' => '已複製',
'auth_failed' => '帳號或密碼錯誤',
'validation' => [
'match' => '與 :attribute 不匹配。',
'minlength' => ':attribute 長度不能少於 :min。',
'maxlength' => ':attribute 長度不能超過 :max。',
],
];
<?php
return [
'labels' => [
'Extensions' => '擴展',
],
'fields' => [
'alias' => '別名',
'description' => '說明',
'authors' => '作者',
'homepage' => '首頁',
'require' => '依賴',
'require_dev' => '開發環境依賴',
'name' => '名稱',
'version' => '版本',
'enable' => '啟用',
'config' => '設定',
'imported' => '導入',
],
'options' => [
],
];
<?php
return [
'fields' => [
'id' => 'ID',
'name' => '名稱',
'username' => '用戶名',
'email' => '信箱',
'http_path' => 'HTTP路徑',
'password' => '密碼',
'password_confirmation' => '確認密碼',
'created_at' => '建立時間',
'updated_at' => '更新時間',
'permissions' => '權限',
'slug' => '標示',
'user' => '用戶',
'order' => '排序',
'ip' => 'IP',
'method' => '方法',
'uri' => 'URI',
'roles' => '角色',
'path' => '路徑',
'input' => '輸入',
'type' => '类型',
],
'labels' => [
'list' => '列表',
'edit' => '編輯',
'detail' => '詳細',
'create' => '創建',
'root' => 'root',
'scaffold' => '代碼生成器',
],
'options' => [
'permissions' => [
],
],
];
<?php
return [
'titles' => [
'index' => '首頁',
'admin' => '系統',
'users' => '管理員',
'roles' => '角色',
'permission' => '權限',
'menu' => '菜單',
'operation_log' => '操作日誌',
'helpers' => '開發工具',
'extensions' => '擴展',
'scaffold' => '代碼生成器',
'icons' => '圖示',
],
];
import './bootstrap';
import _ from 'lodash';
window._ = _;
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/
// import Echo from 'laravel-echo';
// import Pusher from 'pusher-js';
// window.Pusher = Pusher;
// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: import.meta.env.VITE_PUSHER_APP_KEY,
// cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1',
// wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`,
// wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80,
// wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443,
// forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https',
// enabledTransports: ['ws', 'wss'],
// });
<style>
.mailbox-attachment-icon {
max-height: none;
}
.mailbox-attachment-info {
background: #fff;
}
.mailbox-attachments .img-thumbnail {
border: 1px solid #fff;
border-radius: 0;
background-color: #fff;
}
.mailbox-attachment-icon.has-img>img {
max-width: 100% !important;
/*height: 180px!important;*/
}
.mailbox-attachment-info .item {
margin-bottom: 6px;
}
.mailbox-attachments li {
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .08);
border: 0;
background: #fff;
}
body.dark-mode .table {
background-color: #2c2c43;
}
body.dark-mode .mailbox-attachments .img-thumbnail {
border-color: #223;
background-color: #223;
}
body.dark-mode .mailbox-attachment-info {
background: #223;
}
body.dark-mode .mailbox-attachments li {
border-color: #223;
background-color: #223;
}
body.dark-mode .mailbox-attachment-name {
color: #a8a9bb
}
</style>
<div class="dcat-box custom-data-table dt-bootstrap4">
@include('admin::grid.table-toolbar')
{!! $grid->renderFilter() !!}
{!! $grid->renderHeader() !!}
<div class="table-responsive table-wrapper mt-1">
<ul class="mailbox-attachments clearfix {{ $grid->formatTableClass() }} p-0" id="{{ $tableId }}">
@foreach($grid->rows() as $row)
<li>
<span class="mailbox-attachment-icon has-img">
{!! $row->column('url') !!}
</span>
<div class="mailbox-attachment-info">
{{-- <div class="d-flex justify-content-between item">--}}
{{-- <span class="mailbox-attachment-name">{!! $grid->columns()->get('id')->getLabel() !!}</span> {!! $row->column('id') !!}--}}
{{-- </div>--}}
<div class=" justify-content-between item" style="text-align: center; font-size: 24px;font-weight: 500">
{!! $row->column('title') !!}
</div>
<span class="d-flex justify-content-between" style="margin-top: 5px">
{!! $row->column(Dcat\Admin\Grid\Column::SELECT_COLUMN_NAME) !!}
<div>{!! $row->column(Dcat\Admin\Grid\Column::ACTION_COLUMN_NAME) !!}</div>
</span>
</div>
</li>
@endforeach
</ul>
</div>
{!! $grid->renderFooter() !!}
@include('admin::grid.table-pagination')
</div>
\ No newline at end of file
<style>
.row {
margin: 0;
}
.col-md-12,
.col-md-3 {
padding: 0;
}
@media screen and (min-width: 1000px) and (max-width: 1150px) {
.col-lg-3,
.col-lg-9 {
flex: 0 0 50%;
max-width: 50%;
}
}
@media screen and (min-width: 1151px) and (max-width: 1300px) {
.col-lg-3 {
flex: 0 0 40%;
max-width: 40%;
}
.col-lg-9 {
flex: 0 0 60%;
max-width: 60%;
}
}
@media screen and (min-width: 1301px) and (max-width: 1700px) {
.col-lg-3 {
flex: 0 0 35%;
max-width: 35%;
}
.col-lg-9 {
flex: 0 0 65%;
max-width: 65%;
}
}
.login-page {
height: auto;
}
.login-main {
position: relative;
display: flex;
min-height: 100vh;
flex-direction: row;
align-items: stretch;
margin: 0;
}
.login-main .login-page {
background-color: #fff;
}
.login-main .card {
box-shadow: none;
}
.login-main .auth-brand {
margin: 4rem 0 4rem;
font-size: 26px;
width: 455px;
}
@media (max-width: 576px) {
.login-main .auth-brand {
width: 90%;
margin-left: 24px
}
}
.login-main .login-logo {
font-size: 2.1rem;
font-weight: 300;
margin-bottom: 0.9rem;
text-align: left;
margin-left: 20px;
}
.login-main .login-box-msg {
margin: 0;
padding: 0 0 20px;
font-size: 0.9rem;
font-weight: 400;
text-align: left;
}
.login-main .btn {
width: 100%;
}
.login-page-right {
padding: 6rem 3rem;
flex: 1;
position: relative;
color: #fff;
background-color: rgba(0, 0, 0, 0.3);
text-align: center !important;
background: url(/vendor/dcat-admin/images/bg.jpg) center;
background-size: cover;
}
.login-description {
position: absolute;
margin: 0 auto;
padding: 0 1.75rem;
bottom: 3rem;
left: 0;
right: 0;
}
.content-front {
position: absolute;
left: 0;
right: 0;
height: 100vh;
background: rgba(0, 0, 0, .1);
margin-top: -6rem;
}
body.dark-mode .content-front {
background: rgba(0, 0, 0, .3);
}
body.dark-mode .auth-brand {
color: #cacbd6
}
</style>
<div class="row login-main">
<div class="col-lg-3 col-12 bg-white">
<div class="login-page">
<div class="auth-brand text-lg-left">
{!! config('admin.logo') !!}
</div>
<div class="login-box">
<div class="login-logo mb-2">
<h4 class="mt-0"></h4>
<p class="login-box-msg mt-1 mb-1">{{ __('admin.welcome_back') }}</p>
</div>
<div class="card">
<div class="card-body login-card-body">
<form id="login-form" method="POST" action="{{ admin_url('auth/login') }}">
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<fieldset class="form-label-group form-group position-relative has-icon-left">
<input type="text" class="form-control {{ $errors->has('username') ? 'is-invalid' : '' }}" name="username" placeholder="{{ trans('admin.username') }}" value="" required autofocus>
<div class="form-control-position">
<i class="feather icon-user"></i>
</div>
<label for="email">{{ trans('admin.username') }}</label>
<div class="help-block with-errors"></div>
@if($errors->has('username'))
<span class="invalid-feedback text-danger" role="alert">
@foreach($errors->get('username') as $message)
<span class="control-label" for="inputError"><i class="feather icon-x-circle"></i> {{$message}}</span><br>
@endforeach
</span>
@endif
</fieldset>
<fieldset class="form-label-group form-group position-relative has-icon-left">
<input minlength="5" maxlength="20" id="password" type="password" class="form-control {{ $errors->has('password') ? 'is-invalid' : '' }}" name="password" placeholder="{{ trans('admin.password') }}" required value="" autocomplete="current-password">
<div class="form-control-position">
<i class="feather icon-lock"></i>
</div>
<label for="password">{{ trans('admin.password') }}</label>
<div class="help-block with-errors"></div>
@if($errors->has('password'))
<span class="invalid-feedback text-danger" role="alert">
@foreach($errors->get('password') as $message)
<span class="control-label" for="inputError"><i class="feather icon-x-circle"></i> {{$message}}</span><br>
@endforeach
</span>
@endif
</fieldset>
<div class="form-group d-flex justify-content-between align-items-center">
<div class="text-left">
<fieldset class="checkbox">
<div class="vs-checkbox-con vs-checkbox-primary">
<input id="remember" name="remember" value="1" type="checkbox" {{ old('remember') ? 'checked' : '' }}>
<span class="vs-checkbox">
<span class="vs-checkbox--check">
<i class="vs-icon feather icon-check"></i>
</span>
</span>
<span> {{ trans('admin.remember_me') }}</span>
</div>
</fieldset>
</div>
</div>
<button type="submit" class="btn btn-primary float-right login-btn">
{{ __('admin.login') }}
&nbsp;
<i class="feather icon-arrow-right"></i>
</button>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-9 col-12 login-page-right">
<div class="content-front"></div>
<div class="login-description">
<p class="lead">
</p>
<p>
</p>
</div>
</div>
</div>
<script>
Dcat.ready(function() {
// ajax表单提交
$('#login-form').form({
validate: true,
});
});
</script>
\ No newline at end of file
@if($user)
<li class="dropdown dropdown-user nav-item">
<a class="dropdown-toggle nav-link dropdown-user-link" href="#" data-toggle="dropdown">
<div class="user-nav d-sm-flex d-none">
<span class="user-name text-bold-600">{{ $user->name }}</span>
<span class="user-status"><i class="fa fa-circle text-success"></i> {{ trans('admin.online') }}</span>
</div>
<span>
<img class="round" src="{{ $user->getAvatar() }}" alt="avatar" height="40" width="40" />
</span>
</a>
<div class="dropdown-menu dropdown-menu-right">
<a href="{{ admin_url('auth/setting') }}" class="dropdown-item">
<i class="feather icon-user"></i> {{ trans('admin.setting') }}
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{ admin_url('auth/logout') }}">
<i class="feather icon-power"></i> {{ trans('admin.logout') }}
</a>
</div>
</li>
@endif
\ No newline at end of file
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<!-- Fonts -->
<link href="https://fonts.bunny.net/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet">
<!-- Styles -->
<style>
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}a{background-color:transparent}[hidden]{display:none}html{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}*,:after,:before{box-sizing:border-box;border:0 solid #e2e8f0}a{color:inherit;text-decoration:inherit}svg,video{display:block;vertical-align:middle}video{max-width:100%;height:auto}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-t{border-top-width:1px}.flex{display:flex}.grid{display:grid}.hidden{display:none}.items-center{align-items:center}.justify-center{justify-content:center}.font-semibold{font-weight:600}.h-5{height:1.25rem}.h-8{height:2rem}.h-16{height:4rem}.text-sm{font-size:.875rem}.text-lg{font-size:1.125rem}.leading-7{line-height:1.75rem}.mx-auto{margin-left:auto;margin-right:auto}.ml-1{margin-left:.25rem}.mt-2{margin-top:.5rem}.mr-2{margin-right:.5rem}.ml-2{margin-left:.5rem}.mt-4{margin-top:1rem}.ml-4{margin-left:1rem}.mt-8{margin-top:2rem}.ml-12{margin-left:3rem}.-mt-px{margin-top:-1px}.max-w-6xl{max-width:72rem}.min-h-screen{min-height:100vh}.overflow-hidden{overflow:hidden}.p-6{padding:1.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.pt-8{padding-top:2rem}.fixed{position:fixed}.relative{position:relative}.top-0{top:0}.right-0{right:0}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.text-center{text-align:center}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity))}.underline{text-decoration:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.w-5{width:1.25rem}.w-8{width:2rem}.w-auto{width:auto}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}@media (min-width:640px){.sm\:rounded-lg{border-radius:.5rem}.sm\:block{display:block}.sm\:items-center{align-items:center}.sm\:justify-start{justify-content:flex-start}.sm\:justify-between{justify-content:space-between}.sm\:h-20{height:5rem}.sm\:ml-0{margin-left:0}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:pt-0{padding-top:0}.sm\:text-left{text-align:left}.sm\:text-right{text-align:right}}@media (min-width:768px){.md\:border-t-0{border-top-width:0}.md\:border-l{border-left-width:1px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:1024px){.lg\:px-8{padding-left:2rem;padding-right:2rem}}@media (prefers-color-scheme:dark){.dark\:bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity))}.dark\:bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity))}.dark\:border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity))}.dark\:text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.dark\:text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.dark\:text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}}
</style>
<style>
body {
font-family: 'Nunito', sans-serif;
}
</style>
</head>
<body class="antialiased">
<div class="relative flex items-top justify-center min-h-screen bg-gray-100 dark:bg-gray-900 sm:items-center py-4 sm:pt-0">
@if (Route::has('login'))
<div class="hidden fixed top-0 right-0 px-6 py-4 sm:block">
@auth
<a href="{{ url('/home') }}" class="text-sm text-gray-700 dark:text-gray-500 underline">Home</a>
@else
<a href="{{ route('login') }}" class="text-sm text-gray-700 dark:text-gray-500 underline">Log in</a>
@if (Route::has('register'))
<a href="{{ route('register') }}" class="ml-4 text-sm text-gray-700 dark:text-gray-500 underline">Register</a>
@endif
@endauth
</div>
@endif
<div class="max-w-6xl mx-auto sm:px-6 lg:px-8">
<div class="flex justify-center pt-8 sm:justify-start sm:pt-0">
<svg viewBox="0 0 651 192" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-16 w-auto text-gray-700 sm:h-20">
<g clip-path="url(#clip0)" fill="#EF3B2D">
<path d="M248.032 44.676h-16.466v100.23h47.394v-14.748h-30.928V44.676zM337.091 87.202c-2.101-3.341-5.083-5.965-8.949-7.875-3.865-1.909-7.756-2.864-11.669-2.864-5.062 0-9.69.931-13.89 2.792-4.201 1.861-7.804 4.417-10.811 7.661-3.007 3.246-5.347 6.993-7.016 11.239-1.672 4.249-2.506 8.713-2.506 13.389 0 4.774.834 9.26 2.506 13.459 1.669 4.202 4.009 7.925 7.016 11.169 3.007 3.246 6.609 5.799 10.811 7.66 4.199 1.861 8.828 2.792 13.89 2.792 3.913 0 7.804-.955 11.669-2.863 3.866-1.908 6.849-4.533 8.949-7.875v9.021h15.607V78.182h-15.607v9.02zm-1.431 32.503c-.955 2.578-2.291 4.821-4.009 6.73-1.719 1.91-3.795 3.437-6.229 4.582-2.435 1.146-5.133 1.718-8.091 1.718-2.96 0-5.633-.572-8.019-1.718-2.387-1.146-4.438-2.672-6.156-4.582-1.719-1.909-3.032-4.152-3.938-6.73-.909-2.577-1.36-5.298-1.36-8.161 0-2.864.451-5.585 1.36-8.162.905-2.577 2.219-4.819 3.938-6.729 1.718-1.908 3.77-3.437 6.156-4.582 2.386-1.146 5.059-1.718 8.019-1.718 2.958 0 5.656.572 8.091 1.718 2.434 1.146 4.51 2.674 6.229 4.582 1.718 1.91 3.054 4.152 4.009 6.729.953 2.577 1.432 5.298 1.432 8.162-.001 2.863-.479 5.584-1.432 8.161zM463.954 87.202c-2.101-3.341-5.083-5.965-8.949-7.875-3.865-1.909-7.756-2.864-11.669-2.864-5.062 0-9.69.931-13.89 2.792-4.201 1.861-7.804 4.417-10.811 7.661-3.007 3.246-5.347 6.993-7.016 11.239-1.672 4.249-2.506 8.713-2.506 13.389 0 4.774.834 9.26 2.506 13.459 1.669 4.202 4.009 7.925 7.016 11.169 3.007 3.246 6.609 5.799 10.811 7.66 4.199 1.861 8.828 2.792 13.89 2.792 3.913 0 7.804-.955 11.669-2.863 3.866-1.908 6.849-4.533 8.949-7.875v9.021h15.607V78.182h-15.607v9.02zm-1.432 32.503c-.955 2.578-2.291 4.821-4.009 6.73-1.719 1.91-3.795 3.437-6.229 4.582-2.435 1.146-5.133 1.718-8.091 1.718-2.96 0-5.633-.572-8.019-1.718-2.387-1.146-4.438-2.672-6.156-4.582-1.719-1.909-3.032-4.152-3.938-6.73-.909-2.577-1.36-5.298-1.36-8.161 0-2.864.451-5.585 1.36-8.162.905-2.577 2.219-4.819 3.938-6.729 1.718-1.908 3.77-3.437 6.156-4.582 2.386-1.146 5.059-1.718 8.019-1.718 2.958 0 5.656.572 8.091 1.718 2.434 1.146 4.51 2.674 6.229 4.582 1.718 1.91 3.054 4.152 4.009 6.729.953 2.577 1.432 5.298 1.432 8.162 0 2.863-.479 5.584-1.432 8.161zM650.772 44.676h-15.606v100.23h15.606V44.676zM365.013 144.906h15.607V93.538h26.776V78.182h-42.383v66.724zM542.133 78.182l-19.616 51.096-19.616-51.096h-15.808l25.617 66.724h19.614l25.617-66.724h-15.808zM591.98 76.466c-19.112 0-34.239 15.706-34.239 35.079 0 21.416 14.641 35.079 36.239 35.079 12.088 0 19.806-4.622 29.234-14.688l-10.544-8.158c-.006.008-7.958 10.449-19.832 10.449-13.802 0-19.612-11.127-19.612-16.884h51.777c2.72-22.043-11.772-40.877-33.023-40.877zm-18.713 29.28c.12-1.284 1.917-16.884 18.589-16.884 16.671 0 18.697 15.598 18.813 16.884h-37.402zM184.068 43.892c-.024-.088-.073-.165-.104-.25-.058-.157-.108-.316-.191-.46-.056-.097-.137-.176-.203-.265-.087-.117-.161-.242-.265-.345-.085-.086-.194-.148-.29-.223-.109-.085-.206-.182-.327-.252l-.002-.001-.002-.002-35.648-20.524a2.971 2.971 0 00-2.964 0l-35.647 20.522-.002.002-.002.001c-.121.07-.219.167-.327.252-.096.075-.205.138-.29.223-.103.103-.178.228-.265.345-.066.089-.147.169-.203.265-.083.144-.133.304-.191.46-.031.085-.08.162-.104.25-.067.249-.103.51-.103.776v38.979l-29.706 17.103V24.493a3 3 0 00-.103-.776c-.024-.088-.073-.165-.104-.25-.058-.157-.108-.316-.191-.46-.056-.097-.137-.176-.203-.265-.087-.117-.161-.242-.265-.345-.085-.086-.194-.148-.29-.223-.109-.085-.206-.182-.327-.252l-.002-.001-.002-.002L40.098 1.396a2.971 2.971 0 00-2.964 0L1.487 21.919l-.002.002-.002.001c-.121.07-.219.167-.327.252-.096.075-.205.138-.29.223-.103.103-.178.228-.265.345-.066.089-.147.169-.203.265-.083.144-.133.304-.191.46-.031.085-.08.162-.104.25-.067.249-.103.51-.103.776v122.09c0 1.063.568 2.044 1.489 2.575l71.293 41.045c.156.089.324.143.49.202.078.028.15.074.23.095a2.98 2.98 0 001.524 0c.069-.018.132-.059.2-.083.176-.061.354-.119.519-.214l71.293-41.045a2.971 2.971 0 001.489-2.575v-38.979l34.158-19.666a2.971 2.971 0 001.489-2.575V44.666a3.075 3.075 0 00-.106-.774zM74.255 143.167l-29.648-16.779 31.136-17.926.001-.001 34.164-19.669 29.674 17.084-21.772 12.428-43.555 24.863zm68.329-76.259v33.841l-12.475-7.182-17.231-9.92V49.806l12.475 7.182 17.231 9.92zm2.97-39.335l29.693 17.095-29.693 17.095-29.693-17.095 29.693-17.095zM54.06 114.089l-12.475 7.182V46.733l17.231-9.92 12.475-7.182v74.537l-17.231 9.921zM38.614 7.398l29.693 17.095-29.693 17.095L8.921 24.493 38.614 7.398zM5.938 29.632l12.475 7.182 17.231 9.92v79.676l.001.005-.001.006c0 .114.032.221.045.333.017.146.021.294.059.434l.002.007c.032.117.094.222.14.334.051.124.088.255.156.371a.036.036 0 00.004.009c.061.105.149.191.222.288.081.105.149.22.244.314l.008.01c.084.083.19.142.284.215.106.083.202.178.32.247l.013.005.011.008 34.139 19.321v34.175L5.939 144.867V29.632h-.001zm136.646 115.235l-65.352 37.625V148.31l48.399-27.628 16.953-9.677v33.862zm35.646-61.22l-29.706 17.102V66.908l17.231-9.92 12.475-7.182v33.841z"/>
</g>
</svg>
</div>
<div class="mt-8 bg-white dark:bg-gray-800 overflow-hidden shadow sm:rounded-lg">
<div class="grid grid-cols-1 md:grid-cols-2">
<div class="p-6">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-8 h-8 text-gray-500"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25" /></svg>
<div class="ml-4 text-lg leading-7 font-semibold"><a href="https://laravel.com/docs" class="underline text-gray-900 dark:text-white">Documentation</a></div>
</div>
<div class="ml-12">
<div class="mt-2 text-gray-600 dark:text-gray-400 text-sm">
Laravel has wonderful, thorough documentation covering every aspect of the framework. Whether you are new to the framework or have previous experience with Laravel, we recommend reading all of the documentation from beginning to end.
</div>
</div>
</div>
<div class="p-6 border-t border-gray-200 dark:border-gray-700 md:border-t-0 md:border-l">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-8 h-8 text-gray-500"><path stroke-linecap="round" d="M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z" /></svg>
<div class="ml-4 text-lg leading-7 font-semibold"><a href="https://laracasts.com" class="underline text-gray-900 dark:text-white">Laracasts</a></div>
</div>
<div class="ml-12">
<div class="mt-2 text-gray-600 dark:text-gray-400 text-sm">
Laracasts offers thousands of video tutorials on Laravel, PHP, and JavaScript development. Check them out, see for yourself, and massively level up your development skills in the process.
</div>
</div>
</div>
<div class="p-6 border-t border-gray-200 dark:border-gray-700">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-8 h-8 text-gray-500"><path stroke-linecap="round" stroke-linejoin="round" d="M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 01.865-.501 48.172 48.172 0 003.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0012 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018z" /></svg>
<div class="ml-4 text-lg leading-7 font-semibold"><a href="https://laravel-news.com/" class="underline text-gray-900 dark:text-white">Laravel News</a></div>
</div>
<div class="ml-12">
<div class="mt-2 text-gray-600 dark:text-gray-400 text-sm">
Laravel News is a community driven portal and newsletter aggregating all of the latest and most important news in the Laravel ecosystem, including new package releases and tutorials.
</div>
</div>
</div>
<div class="p-6 border-t border-gray-200 dark:border-gray-700 md:border-l">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-8 h-8 text-gray-500"><path stroke-linecap="round" stroke-linejoin="round" d="M6.115 5.19l.319 1.913A6 6 0 008.11 10.36L9.75 12l-.387.775c-.217.433-.132.956.21 1.298l1.348 1.348c.21.21.329.497.329.795v1.089c0 .426.24.815.622 1.006l.153.076c.433.217.956.132 1.298-.21l.723-.723a8.7 8.7 0 002.288-4.042 1.087 1.087 0 00-.358-1.099l-1.33-1.108c-.251-.21-.582-.299-.905-.245l-1.17.195a1.125 1.125 0 01-.98-.314l-.295-.295a1.125 1.125 0 010-1.591l.13-.132a1.125 1.125 0 011.3-.21l.603.302a.809.809 0 001.086-1.086L14.25 7.5l1.256-.837a4.5 4.5 0 001.528-1.732l.146-.292M6.115 5.19A9 9 0 1017.18 4.64M6.115 5.19A8.965 8.965 0 0112 3c1.929 0 3.716.607 5.18 1.64" /></svg>
<div class="ml-4 text-lg leading-7 font-semibold text-gray-900 dark:text-white">Vibrant Ecosystem</div>
</div>
<div class="ml-12">
<div class="mt-2 text-gray-600 dark:text-gray-400 text-sm">
Laravel's robust library of first-party tools and libraries, such as <a href="https://forge.laravel.com" class="underline">Forge</a>, <a href="https://vapor.laravel.com" class="underline">Vapor</a>, <a href="https://nova.laravel.com" class="underline">Nova</a>, and <a href="https://envoyer.io" class="underline">Envoyer</a> help you take your projects to the next level. Pair them with powerful open source libraries like <a href="https://laravel.com/docs/billing" class="underline">Cashier</a>, <a href="https://laravel.com/docs/dusk" class="underline">Dusk</a>, <a href="https://laravel.com/docs/broadcasting" class="underline">Echo</a>, <a href="https://laravel.com/docs/horizon" class="underline">Horizon</a>, <a href="https://laravel.com/docs/sanctum" class="underline">Sanctum</a>, <a href="https://laravel.com/docs/telescope" class="underline">Telescope</a>, and more.
</div>
</div>
</div>
</div>
</div>
<div class="flex justify-center mt-4 sm:items-center sm:justify-between">
<div class="text-center text-sm text-gray-500 sm:text-left">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="-mt-px w-5 h-5 text-gray-400">
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 3h1.386c.51 0 .955.343 1.087.835l.383 1.437M7.5 14.25a3 3 0 00-3 3h15.75m-12.75-3h11.218c1.121-2.3 2.1-4.684 2.924-7.138a60.114 60.114 0 00-16.536-1.84M7.5 14.25L5.106 5.272M6 20.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm12.75 0a.75.75 0 11-1.5 0 .75.75 0 011.5 0z" />
</svg>
<a href="https://laravel.bigcartel.com" class="ml-1 underline">
Shop
</a>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="ml-4 -mt-px w-5 h-5 text-gray-400">
<path stroke-linecap="round" stroke-linejoin="round" d="M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12z" />
</svg>
<a href="https://github.com/sponsors/taylorotwell" class="ml-1 underline">
Sponsor
</a>
</div>
</div>
<div class="ml-4 text-center text-sm text-gray-500 sm:text-right sm:ml-0">
Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})
</div>
</div>
</div>
</div>
</body>
</html>
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
//Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
// return $request->user();
//});
Route::namespace('App\Http\Controllers\Api')->middleware('acceptJson')->group(function () {
Route::middleware('auth:sanctum')->group(function () {
});
});
<?php
use Illuminate\Support\Facades\Broadcast;
/*
|--------------------------------------------------------------------------
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your
| application supports. The given channel authorization callbacks are
| used to check if an authenticated user can listen to the channel.
|
*/
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});
<?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
<?php
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
return $request->user();
});
Route::get('/', function () {
return view('welcome');
});
*
!public/
!.gitignore
compiled.php
config.php
down
events.scanned.php
maintenance.php
routes.php
routes.scanned.php
schedule-*
services.json
<?php
namespace Tests;
use Illuminate\Contracts\Console\Kernel;
trait CreatesApplication
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
return $app;
}
}
<?php
namespace Tests\Feature;
// use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function test_the_application_returns_a_successful_response()
{
$response = $this->get('/');
$response->assertStatus(200);
}
}
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
}
<?php
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function test_that_true_is_true()
{
$this->assertTrue(true);
}
}
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 to comment