Compare commits

...

2 Commits

3 changed files with 43 additions and 13 deletions

View File

@ -0,0 +1,26 @@
<?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('companies', function (Blueprint $table)
{
$table->string('inn')->nullable()->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
}
};

View File

@ -22,10 +22,12 @@ public function __invoke(Request $request)
'name' => 'required|max:255', 'name' => 'required|max:255',
'email' => 'required|email|unique:companies', 'email' => 'required|email|unique:companies',
'phone' => 'required', 'phone' => 'required',
'inn' => 'required|unique:companies', 'inn' => 'required_if:type,' . CompanyType::Agency->value . '|unique:companies',
'legal_address' => 'required',
'type' => Rule::enum(CompanyType::class), 'type' => Rule::enum(CompanyType::class),
'city_id' => 'required' 'city_id' => 'required'
],
[
'inn.required_if' => 'Необходимо указать ИНН агентства'
]); ]);
$request->request->add([ $request->request->add([

View File

@ -60,17 +60,19 @@ class="form-label">{{ __(ucfirst(strtolower($type)) . ' name') }}</label>
@enderror @enderror
</div> </div>
<div class="mb-3"> @if($type != Modules\Main\Models\Company\CompanyType::SelfEmployer->value)
<label for="companyInn" class="form-label">{{ __('Inn') }}</label> <div class="mb-3">
<input type="text" class="form-control" id="companyInn" name="inn" <label for="companyInn" class="form-label">{{ __('Inn') }}</label>
value="{{ old('inn') }}"> <input type="text" class="form-control" id="companyInn" name="inn"
@error('inn') value="{{ old('inn') }}">
<span class="invalid-feedback d-block" role="alert"> @error('inn')
<strong>{{ $message }}</strong> <span class="invalid-feedback d-block" role="alert">
</span> <strong>{{ $message }}</strong>
@enderror </span>
</div> @enderror
<div class="mb-3"> </div>
@endif
<div class="mb-3 d-none">
<label for="companyLegalAddress" class="form-label">{{ __('Legal address') }}</label> <label for="companyLegalAddress" class="form-label">{{ __('Legal address') }}</label>
<input type="text" class="form-control" id="companyLegalAddress" name="legal_address" <input type="text" class="form-control" id="companyLegalAddress" name="legal_address"
value="{{ old('legal_address') }}"> value="{{ old('legal_address') }}">