ranjith-dev #1565

Merged
jothi merged 2 commits from ranjith-dev into master 2026-11-30 08:42:31 +00:00
2 changed files with 91 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class PanelPalletValidation extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'item_id',
'pallet_number',
'serial_number',
'panel_box_supplier',
'panel_box_code',
'panel_box_serial_number',
'pallet_status',
'created_at',
'updated_at',
'scanned_at',
'created_by',
'updated_by',
'scanned_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function item(): BelongsTo
{
return $this->belongsTo(Item::class);
}
}

View File

@@ -0,0 +1,52 @@
<?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
{
$sql = <<<'SQL'
CREATE TABLE panel_pallet_validations (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
plant_id BIGINT NOT NULL,
item_id BIGINT NOT NULL,
pallet_number TEXT NULL,
serial_number TEXT NULL,
panel_box_supplier TEXT NULL,
panel_box_code TEXT NULL,
panel_box_serial_number TEXT NULL,
pallet_status TEXT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
scanned_at TIMESTAMP,
deleted_at TIMESTAMP,
created_by TEXT NULL,
scanned_by TEXT NULL,
updated_by TEXT NULL,
FOREIGN KEY (plant_id) REFERENCES plants (id),
FOREIGN KEY (item_id) REFERENCES items (id)
);
SQL;
DB::statement($sql);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('panel_pallet_validations');
}
};