Selaa lähdekoodia

chore(tbr): remove contants and unique request

ebagabee 1 päivä sitten
vanhempi
commit
5eecfa15ff

+ 1 - 3
app/Http/Requests/TbrRequest.php

@@ -8,10 +8,8 @@ class TbrRequest extends FormRequest
 {
     public function rules(): array
     {
-        $tbrId = $this->route('id');
-
         return [
-            'year'                   => ['required', 'integer', 'min:2000', 'max:2100', "unique:tbrs,year,{$tbrId}"],
+            'year'                   => ['required', 'integer', 'min:2000', 'max:2100'],
             'tbr_value'              => ['required', 'numeric', 'min:0'],
             'royalties_percentage'   => ['required', 'numeric', 'min:0', 'max:1'],
             'fnm_percentage'         => ['required', 'numeric', 'min:0', 'max:1'],

+ 25 - 0
database/migrations/2026_04_30_132635_remove_unique_from_tbrs_year.php

@@ -0,0 +1,25 @@
+<?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('tbrs', function (Blueprint $table) {
+            $table->dropUnique(['year']);
+        });
+    }
+
+    public function down(): void
+    {
+        Schema::table('tbrs', function (Blueprint $table) {
+            $table->unique('year');
+        });
+    }
+};