diff --git a/app/Http/Controllers/Admin/CompanyController.php b/app/Http/Controllers/Admin/CompanyController.php index d863b7d..88a21ed 100644 --- a/app/Http/Controllers/Admin/CompanyController.php +++ b/app/Http/Controllers/Admin/CompanyController.php @@ -48,13 +48,13 @@ class CompanyController extends Controller { $validated = $request->validate([ 'name' => 'required|string|max:255', - 'code' => 'required|string|max:50|unique:companies,code', + 'code' => 'nullable|string|max:50|unique:companies,code', 'original_type' => 'required|string|in:buyout,lease', 'tax_id' => 'nullable|string|max:50', 'contact_name' => 'nullable|string|max:255', 'contact_phone' => 'nullable|string|max:50', 'contact_email' => 'nullable|email|max:255', - 'start_date' => 'required|date', + 'start_date' => 'nullable|date', 'end_date' => 'nullable|date', 'warranty_start_date' => 'nullable|date', 'warranty_end_date' => 'nullable|date', @@ -158,13 +158,13 @@ class CompanyController extends Controller { $validated = $request->validate([ 'name' => 'required|string|max:255', - 'code' => 'required|string|max:50|unique:companies,code,' . $company->id, + 'code' => 'nullable|string|max:50|unique:companies,code,' . $company->id, 'current_type' => 'required|string|in:buyout,lease', 'tax_id' => 'nullable|string|max:50', 'contact_name' => 'nullable|string|max:255', 'contact_phone' => 'nullable|string|max:50', 'contact_email' => 'nullable|email|max:255', - 'start_date' => 'required|date', + 'start_date' => 'nullable|date', 'end_date' => 'nullable|date', 'warranty_start_date' => 'nullable|date', 'warranty_end_date' => 'nullable|date', diff --git a/database/migrations/2026_05_15_164013_make_company_code_nullable_in_companies_table.php b/database/migrations/2026_05_15_164013_make_company_code_nullable_in_companies_table.php new file mode 100644 index 0000000..2e5e8ac --- /dev/null +++ b/database/migrations/2026_05_15_164013_make_company_code_nullable_in_companies_table.php @@ -0,0 +1,28 @@ +string('code', 100)->nullable()->change(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('companies', function (Blueprint $table) { + $table->string('code', 20)->nullable(false)->change(); + }); + } +}; diff --git a/resources/views/admin/companies/index.blade.php b/resources/views/admin/companies/index.blade.php index 592098b..23c55c6 100644 --- a/resources/views/admin/companies/index.blade.php +++ b/resources/views/admin/companies/index.blade.php @@ -795,8 +795,8 @@