Created
February 1, 2021 15:36
-
-
Save stevepop/fc62dc3aa0b64b229591e2d013aee90c to your computer and use it in GitHub Desktop.
Endpoint to update the quantity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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