app/Http/Controllers/JamkesController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $this->validate($request, [
            'name' => 'required|string',
            'abbreviation' => 'required'
        ]);
        try {
            $jamkes = Jamkes::create([
                'name' => $request->name,
                'abbreviation' => $request->abbreviation
            ]);
            return redirect('jamkes')->with(['success' => 'Jamkesmas : <strong>' . $jamkes->name . '</strong> Ditambahkan']);
        } catch (Exception $e) {
            return redirect()->back()->with(['error' => $e->getMessage()]);
        }
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'name' => 'required|string' , 'abbreviation' => 'required' ] ) ; try { $ jamkes = Jamkes :: create ( [ 'name' => $ request -> name , 'abbreviation' => $ request -> abbreviation ] ) ; return redirect ( 'jamkes' ) -> with ( [ 'success' => 'Jamkesmas : <strong>' . $ jamkes -> name . '</strong> Ditambahkan' ] ) ; } catch ( Exception $ e ) { return redirect ( ) -> back ( ) -> with ( [ 'error' => $ e -> getMessage ( ) ] ) ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .