1

im confused how to retrieve data from protected variable array, im already stored data on that variable but when i used it, it returns null.

protected $item_quantity = array();
protected $item_id_pallet_lib = array();

foreach ($itemsUsed as $item) {
$this->item_id_pallet_lib = $this->pallet_assembly_library    
->where('status', '=', 0)                  
->where('item_id', '=', $item->item->id)                                                   ->pluck('item_id');

$this->item_quantity = $this->theoretical
->where('item_id', '=', $this->item_id_pallet_lib)
->pluck('quantity');

}

-------------this is my first attempt to retrieve data, but it fails and it returns null or nothing happens to my theoretical table---------

foreach ($itemsUsed as $item) {

 $this->theoretical
      ->where('item_id', '=', $this->item_id_pallet_lib)
      ->update(array('quantity' => $this->item_quantity));

}

1 Answer 1

1

You just have to add [] so you can store value at the last of your $this->item_id_pallet_lib and $this->item_quantity like so:

$this->item_id_pallet_lib[]
$this->item_quantity[]

Please leave a comment below if it won't work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.