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.

Revisions

  1. stevepop created this gist Feb 1, 2021.
    21 changes: 21 additions & 0 deletions MedicationController
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    <?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',
    ];
    }