I have an inventory system which has an order system, so that an employee can request X product.
The data is taken by the form:
But I don't know how to reference the 'quantity' data so that it is saved
This is myCartController
public function add(Request $request){
$producto = Producto::find($request->id);
$userId = auth()->user()->id; // or any string represents user identifier
Cart::add(
$producto->id,
$producto->descripcion,
"quantity"->quantity
);
return back();
}
The error it gives me is:Attempt to read property "quantity" on string
I could, it was enough
In Laravel, normally the pattern offers the facility of code scaling; this means that your data structures, classes, entities, etc have a standard pattern...
Laravel in particular implements setter and getter: this means that all objects and Classes will have private properties and the getter/setter to access them.
when you try to do this:
it will give you an error, in laravel you are expected to try something like:
Laravel natively implements it
->get()
for its entities and even this one for databases as well:This also applies to requests, this is born from the implementation of OOP (POO Object Oriented Programming)