So im currently working on developing a system where a User of a company can add 'items' to a inventory.
What I need to prevent them doing is adding the same item to the inventory twice (they just adjust the quantity levels. My initial thought was to user generate an Item Code but after investigation companies obviously have their own product codes.
So basically what Im wanting to do within my ItemsForm class (which extends the FormValidator is on the 'item_name' is add validation which would state the following:
protected $rules = [ 'name' => 'required|unique:inventory_items,name,NULL,id,company_id, 2', ];
Where the 2 is in that rule I would want to pass something through like Auth::user()->company->id
If anyone can shed any light on this that would be great.