소스 검색

删除项目Available Days字段

kely 1 년 전
부모
커밋
79772e9100

+ 1 - 1
app/Http/Controllers/API/ProjectController.php

@@ -199,7 +199,7 @@ class ProjectController extends Controller
         $project = Project::findOrFail($id);
 
         $project->fill($request->only([
-            'begin', 'end', 'available_days'
+            'begin', 'end'
         ]));
         $project->save();
 

+ 1 - 1
app/Http/Resources/API/ProjectDetailResource.php

@@ -30,7 +30,7 @@ class ProjectDetailResource extends JsonResource
             'const' => $this->const,
             'begin' => $this->begin,
             'end' => $this->end,
-            'available_days' => $this->available_days,
+            //'available_days' => $this->available_days,
             'latitude' => $this->latitude,
             'longitude' => $this->longitude,
             'type' => $this->type,

+ 1 - 1
app/Models/Project.php

@@ -13,7 +13,7 @@ class Project extends Model
     use HasFactory, Filterable,SoftDeletes;
 
     protected $fillable = [
-        "name","code","const","available_days","status","begin","end","latitude","longitude","type","acl","whitelist","description"
+        "name","code","const","status","begin","end","latitude","longitude","type","acl","whitelist","description"
     ];
 
     protected static function booted(): void

+ 30 - 0
database/migrations/2024_03_14_101754_remove_available_days_to_projects.php

@@ -0,0 +1,30 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     */
+    public function up(): void
+    {
+        Schema::table('projects', function (Blueprint $table) {
+            //
+            $table->dropColumn(['available_days']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::table('projects', function (Blueprint $table) {
+            //
+            $table->integer('available_days')->default(0);
+        });
+    }
+};