Skip to content

Instantly share code, notes, and snippets.

@stevepop
Created February 1, 2021 15:36
Show Gist options
  • Save stevepop/fc62dc3aa0b64b229591e2d013aee90c to your computer and use it in GitHub Desktop.
Save stevepop/fc62dc3aa0b64b229591e2d013aee90c to your computer and use it in GitHub Desktop.
Endpoint to update the quantity
<?php
Class MedicationController extends Controller {
public function update(MedicationInventoryRequest $request)
{
$validated = $request->validated();
$this->updateInventory($validated);
return redirect()->back(303)
->with('message', 'Medication quantity added successfully');
}
}
// FormRequest
public function rules()
{
return [
'medication_id' => 'required|integer',
'quantity' => 'required|integer',
'action' => 'required',
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment