Commit 02e4a26b by 杨树贤

国家地区管理页面

parent 905fcbf0
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\Country;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class CountryController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Country(), function (Grid $grid) {
$grid->showFilter();
$grid->disableActions();
$grid->disableCreateButton();
$grid->filter(function ($filter) {
$filter->expand(true);
$filter->like('name')->width(3);
});
$grid->column('id')->sortable();
$grid->column('name')->editable();
$grid->column('capital');
$grid->column('currency');
$grid->column('currency_name');
$grid->column('currency_symbol');
$grid->column('region');
$grid->column('subregion');
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Country(), function (Show $show) {
$show->field('id');
$show->field('name');
$show->field('capital');
$show->field('currency');
$show->field('currency_name');
$show->field('currency_symbol');
$show->field('region');
$show->field('subregion');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Country(), function (Form $form) {
$form->display('id');
$form->text('name');
$form->text('capital');
$form->text('currency');
$form->text('currency_name');
$form->text('currency_symbol');
$form->text('region');
$form->text('subregion');
});
}
}
...@@ -20,6 +20,6 @@ JS ...@@ -20,6 +20,6 @@ JS
); );
// 返回任意可被渲染的内容 // 返回任意可被渲染的内容
return "<div class='box box-solid box-default no-margin box-show custom-textarea'><div class='box-body' style='min-height: 150px;'>$this->value</div></div>"; return "<div class='box box-solid box-default no-margin box-show custom-textarea'><div class='box-body' style='min-height: 120px;'>$this->value</div></div>";
} }
} }
<?php
namespace App\Admin\Repositories;
use App\Models\Country as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Country extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
...@@ -20,6 +20,7 @@ Route::group([ ...@@ -20,6 +20,7 @@ Route::group([
$router->resource('order', 'OrderController'); $router->resource('order', 'OrderController');
$router->resource('test', 'TestController'); $router->resource('test', 'TestController');
$router->resource('users', 'UserController'); $router->resource('users', 'UserController');
$router->resource('country', 'CountryController');
//下载pdf //下载pdf
Route::get('/api/order_download', '\App\Admin\Controllers\Api\OrderApiController@orderDownload'); Route::get('/api/order_download', '\App\Admin\Controllers\Api\OrderApiController@orderDownload');
}); });
......
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Country extends Model
{
//
protected $table = 'country';
public $timestamps = false;
}
<?php
return [
'labels' => [
'Country' => 'Country',
'country' => 'Country',
],
'fields' => [
],
'options' => [
],
];
...@@ -4,5 +4,6 @@ return [ ...@@ -4,5 +4,6 @@ return [
'titles' => [ 'titles' => [
'userAddress' => 'UserAddress', 'userAddress' => 'UserAddress',
'inquiry' => 'Inquiry', 'inquiry' => 'Inquiry',
'country' => 'Country',
], ],
]; ];
<?php
return [
'labels' => [
'Country' => '国家/地区',
'country' => '国家/地区',
],
'fields' => [
'name' => '名称',
'capital' => '首都',
'currency' => '币种',
'currency_name' => '币种名称',
'currency_symbol' => '币种符号',
'region' => '区域',
'subregion' => '亚区域',
],
'options' => [
],
];
...@@ -15,6 +15,7 @@ return [ ...@@ -15,6 +15,7 @@ return [
'icons' => '图标', 'icons' => '图标',
'userAddress' => '用户地址', 'userAddress' => '用户地址',
'inquiry' => '询价管理', 'inquiry' => '询价管理',
'task' => '任务管理' 'task' => '任务管理',
'country' => '地区管理',
], ],
]; ];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment