check if record exists at import resolutionbasis

This commit is contained in:
ilmedova 2022-11-24 15:28:34 +05:00
parent 502b28fbc5
commit a2784d9df2
2 changed files with 34 additions and 1 deletions

View File

@ -48,8 +48,9 @@ public function resolutionBasis(Request $request){
$resolution['department_id'] = $entry['Department_ID'];
$resolution['resolution_id'] = $entry['Resolution_ID'];
$resolution['resolutionbasis'] = $entry['ResolutionBasis'];
$resolution['foreign_id'] = $entry['ID'];
$res = Resolutionbasis::where('contract_id', $resolution['contract_id'])->first();
$res = Resolutionbasis::where('foreign_id', $resolution['foreign_id'])->first();
if($res == null){
Resolutionbasis::create($resolution);
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('resolutionbasis', function (Blueprint $table) {
$table->bigInteger('foreign_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('resolutionbasis', function (Blueprint $table) {
//
});
}
};