app/Http/Controllers/PasienController.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)
    {
        $antrian = $this->getAntrian();
        $this->validate($request, [
            'name' => 'required',
            'address' => 'required',
            'keluhan' => 'required',
            'jamkes_id' => 'required',
            'dokter_id' => 'required'
        ]);
        try {
            $pasien = Pasien::create([
                'name' => $request->name,
                'address' => $request->address,
                'keluhan' => $request->keluhan,
                'antrian_id' => $antrian,
                'jamkes_id' => $request->jamkes_id,
                'dokter_id' => $request->dokter_id,
            ]);
            return redirect('pasien')->with(['success' => 'Pasien : <strong>' . $pasien->name . '</strong> Ditambahkan']);
        } catch (Exception $e) {
            return redirect()->back()->with(['error' => $e->getMessage()]);
        }
    }
public function store ( Request $ request ) { $ antrian = $ this -> getAntrian ( ) ; $ this -> validate ( $ request , [ 'name' => 'required' , 'address' => 'required' , 'keluhan' => 'required' , 'jamkes_id' => 'required' , 'dokter_id' => 'required' ] ) ; try { $ pasien = Pasien :: create ( [ 'name' => $ request -> name , 'address' => $ request -> address , 'keluhan' => $ request -> keluhan , 'antrian_id' => $ antrian , 'jamkes_id' => $ request -> jamkes_id , 'dokter_id' => $ request -> dokter_id , ] ) ; return redirect ( 'pasien' ) -> with ( [ 'success' => 'Pasien : <strong>' . $ pasien -> 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 .