Commit dbb0210b by 汪伟伟

1

parent b2ccd5e1
......@@ -9,9 +9,9 @@ LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_DATABASE=data-collect
DB_USERNAME=root
DB_PASSWORD=
DB_PASSWORD=123456
BROADCAST_DRIVER=log
CACHE_DRIVER=file
......
......@@ -13,3 +13,4 @@ yarn-error.log
/.idea
/.vscode
composer.lock
/vendor/bin
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\Task;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class TaskController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Task(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('name');
$grid->column('level');
$grid->column('area');
$grid->column('year');
$grid->column('refer');
$grid->column('guide');
$grid->column('status');
$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 Task(), function (Show $show) {
$show->field('id');
$show->field('name');
$show->field('level');
$show->field('area');
$show->field('year');
$show->field('refer');
$show->field('guide');
$show->field('status');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Task(), function (Form $form) {
$form->display('id');
$form->text('name');
$form->text('level');
$form->text('area');
$form->text('year');
$form->text('refer');
$form->text('guide');
$form->text('status');
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Repositories;
use App\Models\Task as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Task extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
......@@ -12,4 +12,6 @@ Route::group([
'middleware' => config('admin.route.middleware'),
], function (Router $router) {
$router->get('/dashboard', 'HomeController@index');
$router->resource('tasks', 'TaskController');
});
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class Task extends Model
{
use HasDateTimeFormatter;
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTasksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tasks', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name')->default('')->comment('指标名称');
$table->integer('level')->default('1')->comment('难度等级');
$table->string('area')->default('')->comment('地区');
$table->string('year')->default('')->comment('年份');
$table->string('refer')->nullable()->comment('参考信源');
$table->longText('guide')->nullable()->comment('收集指南');
$table->tinyInteger('status')->default('0')->nullable()->comment('任务状态');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('tasks');
}
}
<?php
/**
* A helper file for Dcat Admin, to provide autocomplete information to your IDE
*
* This file should not be included in your code, only analyzed by your IDE!
*
* @author jqh <841324345@qq.com>
*/
namespace Dcat\Admin {
use Illuminate\Support\Collection;
/**
* @property Grid\Column|Collection id
* @property Grid\Column|Collection name
* @property Grid\Column|Collection type
* @property Grid\Column|Collection version
* @property Grid\Column|Collection detail
* @property Grid\Column|Collection created_at
* @property Grid\Column|Collection updated_at
* @property Grid\Column|Collection is_enabled
* @property Grid\Column|Collection parent_id
* @property Grid\Column|Collection order
* @property Grid\Column|Collection icon
* @property Grid\Column|Collection uri
* @property Grid\Column|Collection extension
* @property Grid\Column|Collection permission_id
* @property Grid\Column|Collection menu_id
* @property Grid\Column|Collection slug
* @property Grid\Column|Collection http_method
* @property Grid\Column|Collection http_path
* @property Grid\Column|Collection role_id
* @property Grid\Column|Collection user_id
* @property Grid\Column|Collection value
* @property Grid\Column|Collection username
* @property Grid\Column|Collection password
* @property Grid\Column|Collection avatar
* @property Grid\Column|Collection remember_token
* @property Grid\Column|Collection uuid
* @property Grid\Column|Collection connection
* @property Grid\Column|Collection queue
* @property Grid\Column|Collection payload
* @property Grid\Column|Collection exception
* @property Grid\Column|Collection failed_at
* @property Grid\Column|Collection email
* @property Grid\Column|Collection token
* @property Grid\Column|Collection level
* @property Grid\Column|Collection area
* @property Grid\Column|Collection year
* @property Grid\Column|Collection refer
* @property Grid\Column|Collection guide
* @property Grid\Column|Collection status
* @property Grid\Column|Collection email_verified_at
*
* @method Grid\Column|Collection id(string $label = null)
* @method Grid\Column|Collection name(string $label = null)
* @method Grid\Column|Collection type(string $label = null)
* @method Grid\Column|Collection version(string $label = null)
* @method Grid\Column|Collection detail(string $label = null)
* @method Grid\Column|Collection created_at(string $label = null)
* @method Grid\Column|Collection updated_at(string $label = null)
* @method Grid\Column|Collection is_enabled(string $label = null)
* @method Grid\Column|Collection parent_id(string $label = null)
* @method Grid\Column|Collection order(string $label = null)
* @method Grid\Column|Collection icon(string $label = null)
* @method Grid\Column|Collection uri(string $label = null)
* @method Grid\Column|Collection extension(string $label = null)
* @method Grid\Column|Collection permission_id(string $label = null)
* @method Grid\Column|Collection menu_id(string $label = null)
* @method Grid\Column|Collection slug(string $label = null)
* @method Grid\Column|Collection http_method(string $label = null)
* @method Grid\Column|Collection http_path(string $label = null)
* @method Grid\Column|Collection role_id(string $label = null)
* @method Grid\Column|Collection user_id(string $label = null)
* @method Grid\Column|Collection value(string $label = null)
* @method Grid\Column|Collection username(string $label = null)
* @method Grid\Column|Collection password(string $label = null)
* @method Grid\Column|Collection avatar(string $label = null)
* @method Grid\Column|Collection remember_token(string $label = null)
* @method Grid\Column|Collection uuid(string $label = null)
* @method Grid\Column|Collection connection(string $label = null)
* @method Grid\Column|Collection queue(string $label = null)
* @method Grid\Column|Collection payload(string $label = null)
* @method Grid\Column|Collection exception(string $label = null)
* @method Grid\Column|Collection failed_at(string $label = null)
* @method Grid\Column|Collection email(string $label = null)
* @method Grid\Column|Collection token(string $label = null)
* @method Grid\Column|Collection level(string $label = null)
* @method Grid\Column|Collection area(string $label = null)
* @method Grid\Column|Collection year(string $label = null)
* @method Grid\Column|Collection refer(string $label = null)
* @method Grid\Column|Collection guide(string $label = null)
* @method Grid\Column|Collection status(string $label = null)
* @method Grid\Column|Collection email_verified_at(string $label = null)
*/
class Grid {}
class MiniGrid extends Grid {}
/**
* @property Show\Field|Collection id
* @property Show\Field|Collection name
* @property Show\Field|Collection type
* @property Show\Field|Collection version
* @property Show\Field|Collection detail
* @property Show\Field|Collection created_at
* @property Show\Field|Collection updated_at
* @property Show\Field|Collection is_enabled
* @property Show\Field|Collection parent_id
* @property Show\Field|Collection order
* @property Show\Field|Collection icon
* @property Show\Field|Collection uri
* @property Show\Field|Collection extension
* @property Show\Field|Collection permission_id
* @property Show\Field|Collection menu_id
* @property Show\Field|Collection slug
* @property Show\Field|Collection http_method
* @property Show\Field|Collection http_path
* @property Show\Field|Collection role_id
* @property Show\Field|Collection user_id
* @property Show\Field|Collection value
* @property Show\Field|Collection username
* @property Show\Field|Collection password
* @property Show\Field|Collection avatar
* @property Show\Field|Collection remember_token
* @property Show\Field|Collection uuid
* @property Show\Field|Collection connection
* @property Show\Field|Collection queue
* @property Show\Field|Collection payload
* @property Show\Field|Collection exception
* @property Show\Field|Collection failed_at
* @property Show\Field|Collection email
* @property Show\Field|Collection token
* @property Show\Field|Collection level
* @property Show\Field|Collection area
* @property Show\Field|Collection year
* @property Show\Field|Collection refer
* @property Show\Field|Collection guide
* @property Show\Field|Collection status
* @property Show\Field|Collection email_verified_at
*
* @method Show\Field|Collection id(string $label = null)
* @method Show\Field|Collection name(string $label = null)
* @method Show\Field|Collection type(string $label = null)
* @method Show\Field|Collection version(string $label = null)
* @method Show\Field|Collection detail(string $label = null)
* @method Show\Field|Collection created_at(string $label = null)
* @method Show\Field|Collection updated_at(string $label = null)
* @method Show\Field|Collection is_enabled(string $label = null)
* @method Show\Field|Collection parent_id(string $label = null)
* @method Show\Field|Collection order(string $label = null)
* @method Show\Field|Collection icon(string $label = null)
* @method Show\Field|Collection uri(string $label = null)
* @method Show\Field|Collection extension(string $label = null)
* @method Show\Field|Collection permission_id(string $label = null)
* @method Show\Field|Collection menu_id(string $label = null)
* @method Show\Field|Collection slug(string $label = null)
* @method Show\Field|Collection http_method(string $label = null)
* @method Show\Field|Collection http_path(string $label = null)
* @method Show\Field|Collection role_id(string $label = null)
* @method Show\Field|Collection user_id(string $label = null)
* @method Show\Field|Collection value(string $label = null)
* @method Show\Field|Collection username(string $label = null)
* @method Show\Field|Collection password(string $label = null)
* @method Show\Field|Collection avatar(string $label = null)
* @method Show\Field|Collection remember_token(string $label = null)
* @method Show\Field|Collection uuid(string $label = null)
* @method Show\Field|Collection connection(string $label = null)
* @method Show\Field|Collection queue(string $label = null)
* @method Show\Field|Collection payload(string $label = null)
* @method Show\Field|Collection exception(string $label = null)
* @method Show\Field|Collection failed_at(string $label = null)
* @method Show\Field|Collection email(string $label = null)
* @method Show\Field|Collection token(string $label = null)
* @method Show\Field|Collection level(string $label = null)
* @method Show\Field|Collection area(string $label = null)
* @method Show\Field|Collection year(string $label = null)
* @method Show\Field|Collection refer(string $label = null)
* @method Show\Field|Collection guide(string $label = null)
* @method Show\Field|Collection status(string $label = null)
* @method Show\Field|Collection email_verified_at(string $label = null)
*/
class Show {}
/**
*/
class Form {}
}
namespace Dcat\Admin\Grid {
/**
*/
class Column {}
/**
*/
class Filter {}
}
namespace Dcat\Admin\Show {
/**
*/
class Field {}
}
......@@ -3,7 +3,7 @@ services:
web3:
image: tangramor/nginx-php8-fpm
ports:
- '83:80'
- '8383:80'
environment:
TZ: 'Asia/Shanghai'
WEBROOT: '/var/www/html/laravel-box/public'
......
<?php
return [
'labels' => [
'Task' => '系统任务',
'task' => 'Task',
],
'fields' => [
'name' => '指标名称',
'level' => '难度等级',
'area' => '地区',
'year' => '时间',
'refer' => '信源',
'guide' => '参考指南',
'status' => '状态',
],
'options' => [
],
];
<?php return array(
'root' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'a4b79a602c7e388f3fd175aab3abed2b0bebbbe8',
'reference' => 'b2ccd5e1145c3eec84f1160d90a580c58c6ea560',
'name' => 'celaraze/laravel-box',
'dev' => true,
),
......@@ -47,12 +47,12 @@
'dev_requirement' => false,
),
'celaraze/laravel-box' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'a4b79a602c7e388f3fd175aab3abed2b0bebbbe8',
'reference' => 'b2ccd5e1145c3eec84f1160d90a580c58c6ea560',
'dev_requirement' => false,
),
'cordoval/hamcrest-php' => array(
......
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