app/Http/Controllers/JamkesController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, $id)
    {
        $this->validate($request, [
            'name' => 'required|string',
            'abbreviation' => 'required|string'
        ]);
        try {
            $jamkes = Jamkes::findOrFail($id);
            $jamkes->update([
                'name' => $request->name,
                'abbreviation' => $request->abbreviation
            ]);
            return redirect('jamkes')->with(['success' => 'Jamkesmas : <strong>' . $jamkes->name . '</strong> Diupdate']);
        } catch (Exception $e) {
            return redirect()->back()->with(['error' => $e->getMessage()]);
        }
    }
public function update ( Request $ request , $ id ) { $ this -> validate ( $ request , [ 'name' => 'required|string' , 'abbreviation' => 'required|string' ] ) ; try { $ jamkes = Jamkes :: findOrFail ( $ id ) ; $ jamkes -> update ( [ 'name' => $ request -> name , 'abbreviation' => $ request -> abbreviation ] ) ; return redirect ( 'jamkes' ) -> with ( [ 'success' => 'Jamkesmas : <strong>' . $ jamkes -> name . '</strong> Diupdate' ] ) ; } catch ( Exception $ e ) { return redirect ( ) -> back ( ) -> with ( [ 'error' => $ e -> getMessage ( ) ] ) ; } }
Update the specified resource in storage.
Update the specified resource in storage .