From 81abd7270da52c6a45e064d7cf1e9438cd4e6b85 Mon Sep 17 00:00:00 2001 From: Jing Li Date: Wed, 16 Nov 2022 15:10:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A8=BB=E8=99=BE=E6=B5=81=E5=90=91=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/RiceShrimpFlowController.php | 6 ++++-- app/Http/Requestes/RiceShrimpFlowStoreRequest.php | 2 ++ app/Http/Requestes/RiceShrimpFlowUpdateRequest.php | 2 ++ app/Http/Resources/RiceShrimpFlowResource.php | 1 + app/Models/RiceShrimpFlow.php | 1 + .../2022_11_01_172739_create_rice_shrimp_flows_table.php | 1 + 6 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/RiceShrimpFlowController.php b/app/Http/Controllers/RiceShrimpFlowController.php index 7333ca9..ac958e4 100644 --- a/app/Http/Controllers/RiceShrimpFlowController.php +++ b/app/Http/Controllers/RiceShrimpFlowController.php @@ -2,15 +2,15 @@ namespace App\Http\Controllers; +use App\Enums\OperationType; use App\Http\Requestes\RiceShrimpFlowStoreRequest; use App\Http\Requestes\RiceShrimpFlowUpdateRequest; use App\Http\Resources\RiceShrimpFlowResource; use App\Models\RiceShrimpFlow; +use App\Services\OperationLogService; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\ResourceCollection; -use App\Services\OperationLogService; -use App\Enums\OperationType; class RiceShrimpFlowController extends Controller { @@ -48,6 +48,7 @@ class RiceShrimpFlowController extends Controller 'quarter', 'area', 'sales', + 'unit', ]) ); $riceShrimpFlow->created_by = $user->id; @@ -80,6 +81,7 @@ class RiceShrimpFlowController extends Controller 'quarter', 'area', 'sales', + 'unit', ] as $key) { if ($request->filled($key)) { $riceShrimpFlow->{$key} = $request->input($key); diff --git a/app/Http/Requestes/RiceShrimpFlowStoreRequest.php b/app/Http/Requestes/RiceShrimpFlowStoreRequest.php index 2f649ff..d45d227 100644 --- a/app/Http/Requestes/RiceShrimpFlowStoreRequest.php +++ b/app/Http/Requestes/RiceShrimpFlowStoreRequest.php @@ -19,6 +19,7 @@ class RiceShrimpFlowStoreRequest extends FormRequest 'quarter' => ['required', new Quarter()], 'area' => ['required', 'string'], 'sales' => ['required', 'int', 'min:0'], + 'unit' => ['required', 'string'], ]; } @@ -29,6 +30,7 @@ class RiceShrimpFlowStoreRequest extends FormRequest 'quarter' => '季度', 'area' => '地区', 'sales' => '销量', + 'unit' => '单位', ]; } } diff --git a/app/Http/Requestes/RiceShrimpFlowUpdateRequest.php b/app/Http/Requestes/RiceShrimpFlowUpdateRequest.php index 2195ac4..daa04d9 100644 --- a/app/Http/Requestes/RiceShrimpFlowUpdateRequest.php +++ b/app/Http/Requestes/RiceShrimpFlowUpdateRequest.php @@ -19,6 +19,7 @@ class RiceShrimpFlowUpdateRequest extends FormRequest 'quarter' => ['filled', new Quarter()], 'area' => ['filled', 'string'], 'sales' => ['filled', 'int', 'min:0'], + 'unit' => ['filled', 'string'], ]; } @@ -29,6 +30,7 @@ class RiceShrimpFlowUpdateRequest extends FormRequest 'quarter' => '季度', 'area' => '地区', 'sales' => '销量', + 'unit' => '单位', ]; } } diff --git a/app/Http/Resources/RiceShrimpFlowResource.php b/app/Http/Resources/RiceShrimpFlowResource.php index dd74612..95ef931 100644 --- a/app/Http/Resources/RiceShrimpFlowResource.php +++ b/app/Http/Resources/RiceShrimpFlowResource.php @@ -20,6 +20,7 @@ class RiceShrimpFlowResource extends JsonResource 'quarter' => $this->quarter, 'area' => $this->area, 'sales' => $this->sales, + 'unit' => $this->unit, 'created_by' => AdminUserResource::make($this->whenLoaded('createdBy')), 'updated_by' => AdminUserResource::make($this->whenLoaded('updatedBy')), 'created_at' => $this->created_at->unix(), diff --git a/app/Models/RiceShrimpFlow.php b/app/Models/RiceShrimpFlow.php index ea45b1b..54c4621 100644 --- a/app/Models/RiceShrimpFlow.php +++ b/app/Models/RiceShrimpFlow.php @@ -15,6 +15,7 @@ class RiceShrimpFlow extends Model 'quarter', 'area', 'sales', + 'unit', 'created_by', 'updated_by', ]; diff --git a/database/migrations/2022_11_01_172739_create_rice_shrimp_flows_table.php b/database/migrations/2022_11_01_172739_create_rice_shrimp_flows_table.php index 8e6ff45..d84475a 100644 --- a/database/migrations/2022_11_01_172739_create_rice_shrimp_flows_table.php +++ b/database/migrations/2022_11_01_172739_create_rice_shrimp_flows_table.php @@ -19,6 +19,7 @@ return new class extends Migration $table->tinyInteger('quarter')->comment('季度'); $table->string('area')->comment('地区'); $table->unsignedBigInteger('sales')->comment('销量'); + $table->string('unit')->comment('单位'); $table->unsignedBigInteger('created_by')->comment('创建人ID'); $table->unsignedBigInteger('updated_by')->comment('修改人ID'); $table->timestamps();