Skip to main content

Laravel-admin精华

改为中文

需要在config/app.php里面修改:

'locale' => 'zh-CN',

1.先创建模型

php artisan make:model App\Models\Users

2.再创建控制器

php artisan admin:make UsersController --model=App\Models\Users

php artisan make:model App\Models\WechatMiniGotoApp

php artisan admin:make SendGoodsController --model=App\Models\SendGoods

php artisan admin:make AnimalsController --model=App\Models\Animals

php artisan admin:make DownstreamOrdersController --model=App\Models\DownstreamOrders

php artisan admin:action SendGoods\BatchSend --grid-batch --name="批量发放"

创建迁移

使用 make:migration Artisan 命令来创建迁移:

php artisan make:migration create_users_table

API

创建一个 Product 资源

API 资源是在 Laravel 中将你的模型以及模型集合转换为 JSON 的新特性。接下来让我们创建一个 Product 的资源。

php artisan make:resource Product

在 app/Http/Resources 目录下看到你刚刚生成的 Product 资源

生成 事件&监听器

php artisan event:generate

用命令admin:form来生成表单类文件:

php artisan admin:form Setting --title=网站设置`

php artisan make:model App\Models\BlackList

php artisan make:model App\Models\FailedJobs

php artisan make:model App\Models\Merchants

php artisan make:model App\Models\MerchantsBalance

php artisan make:model App\Models\MerchantsBalanceApply

php artisan make:model App\Models\MerchantsBalanceRecords

php artisan make:model App\Models\MerchantsPhone

php artisan make:model App\Models\MerchantsPhoneAssists

php artisan make:model App\Models\Migrations

php artisan make:model App\Models\PasswordResets

php artisan make:model App\Models\UserOrderAssists

php artisan make:model App\Models\UserOrders

php artisan make:model App\Models\Users

php artisan make:model App\Models\UsersBalance

php artisan make:model App\Models\UsersBalanceApply

php artisan make:model App\Models\UsersBalanceRecords

php artisan make:model App\Models\Platform

php artisan admin:make BlackListController --model=App\Models\BlackList

php artisan admin:make FailedJobsController --model=App\Models\FailedJobs

php artisan admin:make MerchantsController --model=App\Models\Merchants

php artisan admin:make MerchantsBalanceController --model=App\Models\MerchantsBalance

php artisan admin:make MerchantsBalanceApplyController --model=App\Models\MerchantsBalanceApply

php artisan admin:make MerchantsBalanceRecordsController --model=App\Models\MerchantsBalanceRecords

php artisan admin:make MerchantsPhoneController --model=App\Models\MerchantsPhone

php artisan admin:make MerchantsPhoneAssistsController --model=App\Models\MerchantsPhoneAssists

php artisan admin:make MigrationsController --model=App\Models\Migrations

php artisan admin:make PasswordResetsController --model=App\Models\PasswordResets

php artisan admin:make UserOrderAssistsController --model=App\Models\UserOrderAssists

php artisan admin:make UserOrdersController --model=App\Models\UserOrders

php artisan admin:make UsersController --model=App\Models\Users

php artisan admin:make UsersBalanceController --model=App\Models\UsersBalance

php artisan admin:make UsersBalanceApplyController --model=App\Models\UsersBalanceApply

php artisan admin:make UsersBalanceRecordsController --model=App\Models\UsersBalanceRecords

php artisan admin:make PlatformController --model=App\Models\Platform

$router->resource('black-lists', BlackListController::class);

$router->resource('failed-jobs', FailedJobsController::class);

$router->resource('merchants', MerchantsController::class);

$router->resource('merchants-balances', MerchantsBalanceController::class);

$router->resource('merchants-balance-applies', MerchantsBalanceApplyController::class);

$router->resource('merchants-balance-records', MerchantsBalanceRecordsController::class);

$router->resource('merchants-phones', MerchantsPhoneController::class);

$router->resource('merchants-phone-assists', MerchantsPhoneAssistsController::class);

$router->resource('migrations', MigrationsController::class);

$router->resource('password-resets', PasswordResetsController::class);

$router->resource('user-order-assists', UserOrderAssistsController::class);

$router->resource('user-orders', UserOrdersController::class);

$router->resource('users', UsersController::class);

$router->resource('users-balances', UsersBalanceController::class);

$router->resource('users-balance-applies', UsersBalanceApplyController::class);

$router->resource('users-balance-records', UsersBalanceRecordsController::class);