From 530078a4d8198a3756535f190a523537d70c66d7 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Tue, 23 Dec 2025 11:19:31 +0530 Subject: [PATCH 1/2] Added foreign key for plant_id and item_characteristics_id for table sticker structure details table --- ...eritic_id_to_sticker_structure_details.php | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 database/migrations/2025_12_22_190230_added_foreign_key_plant_id_item_chracteritic_id_to_sticker_structure_details.php diff --git a/database/migrations/2025_12_22_190230_added_foreign_key_plant_id_item_chracteritic_id_to_sticker_structure_details.php b/database/migrations/2025_12_22_190230_added_foreign_key_plant_id_item_chracteritic_id_to_sticker_structure_details.php new file mode 100644 index 0000000..276bbd6 --- /dev/null +++ b/database/migrations/2025_12_22_190230_added_foreign_key_plant_id_item_chracteritic_id_to_sticker_structure_details.php @@ -0,0 +1,42 @@ + Date: Tue, 23 Dec 2025 11:20:18 +0530 Subject: [PATCH 2/2] Added plant_id and item_characteritics id in model file --- app/Models/StickerStructureDetail.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/Models/StickerStructureDetail.php b/app/Models/StickerStructureDetail.php index 75ad896..a9be47b 100644 --- a/app/Models/StickerStructureDetail.php +++ b/app/Models/StickerStructureDetail.php @@ -3,6 +3,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; class StickerStructureDetail extends Model @@ -11,6 +12,8 @@ class StickerStructureDetail extends Model use SoftDeletes; protected $fillable = [ + 'plant_id', + 'item_characteristic_id', 'sticker_id', 'sticker_width', 'sticker_height', @@ -23,4 +26,15 @@ class StickerStructureDetail extends Model 'created_by', 'updated_by' ]; + + public function plant(): BelongsTo + { + return $this->belongsTo(Plant::class); + } + + public function itemCharacteristic(): BelongsTo + { + return $this->belongsTo(ItemCharacteristic::class, 'item_characteristic_id'); + } + } -- 2.49.1