update
This commit is contained in:
@@ -152,6 +152,7 @@ class DrugController extends Controller
|
|||||||
$importedRows = 0;
|
$importedRows = 0;
|
||||||
$failedRows = [];
|
$failedRows = [];
|
||||||
|
|
||||||
|
|
||||||
foreach ($processedData as $row) {
|
foreach ($processedData as $row) {
|
||||||
try {
|
try {
|
||||||
Drug::updateOrCreate([
|
Drug::updateOrCreate([
|
||||||
@@ -169,11 +170,13 @@ class DrugController extends Controller
|
|||||||
'type' => $row['type'],
|
'type' => $row['type'],
|
||||||
'dosage' => $row['dosage'],
|
'dosage' => $row['dosage'],
|
||||||
'remark' => $row['remark'],
|
'remark' => $row['remark'],
|
||||||
'price' => $row['price'],
|
// 'price' => $row['price'],
|
||||||
|
'unit' => $row['unit'],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$importedRows++;
|
$importedRows++;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
dd($e);
|
||||||
$failedRows[] = $row;
|
$failedRows[] = $row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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('drugs', function (Blueprint $table) {
|
||||||
|
$table->string('unit')->nullable()->after('generic_name');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('drugs', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('unit');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user