app/Http/Controllers/MedicineController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Medicine  $medicine
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, Medicine $medicine)
    {
        $this->validate($request, [
            'name'        => 'required|max:255',
            'description' => 'required',
        ]);
        $medicine->name = request('name');
        $medicine->description = request('description');
        $medicine->amount = request('amount');
        $medicine->price = request('price');
        $medicine->storedDate = request('storedDate');
        $medicine->save();
        return response()->json([
            'message' => 'medicine updated successfully!'
        ], 200);
    }
public function update ( Request $ request , Medicine $ medicine ) { $ this -> validate ( $ request , [ 'name' => 'required|max:255' , 'description' => 'required' , ] ) ; $ medicine -> name = request ( 'name' ) ; $ medicine -> description = request ( 'description' ) ; $ medicine -> amount = request ( 'amount' ) ; $ medicine -> price = request ( 'price' ) ; $ medicine -> storedDate = request ( 'storedDate' ) ; $ medicine -> save ( ) ; return response ( ) -> json ( [ 'message' => 'medicine updated successfully!' ] , 200 ) ; }
Update the specified resource in storage.
Update the specified resource in storage .