app/Http/Controllers/tunjanganController.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)
    {
          $roles=[
                'kode_tunjangan'=>'required|unique:tunjangans',
                'jabatan_id'=>'required',
                'golongan_id'=>'required',
                'besaran_uang'=>'required',
            ];
            $sms=[
                'kode_tunjangan.required'=>'HARAP DI ISI',
                'kode_tunjangan.unique'=>'SUDAH ADA',
                'jabatan_id.required'=>'HARAP DI ISI',
                'golongan_id.required'=>'HARAP DI ISI',
                'besaran_uang.required'=>'HARAP DI ISI',
            ];
            $validasi= Validator::make(Input::all(),$roles,$sms);
            if($validasi->fails()){
                return redirect()->back()
                        ->WithErrors($validasi)
                        ->WithInput();
            }
            $tunjangan=Request::all();
            Tunjangan::create($tunjangan);
            return redirect('tunjangan');
    }
public function store ( Request $ request ) { $ roles = [ 'kode_tunjangan' => 'required|unique:tunjangans' , 'jabatan_id' => 'required' , 'golongan_id' => 'required' , 'besaran_uang' => 'required' , ] ; $ sms = [ 'kode_tunjangan.required' => 'HARAP DI ISI' , 'kode_tunjangan.unique' => 'SUDAH ADA' , 'jabatan_id.required' => 'HARAP DI ISI' , 'golongan_id.required' => 'HARAP DI ISI' , 'besaran_uang.required' => 'HARAP DI ISI' , ] ; $ validasi = Validator :: make ( Input :: all ( ) , $ roles , $ sms ) ; if ( $ validasi -> fails ( ) ) { return redirect ( ) -> back ( ) -> WithErrors ( $ validasi ) -> WithInput ( ) ; } $ tunjangan = Request :: all ( ) ; Tunjangan :: create ( $ tunjangan ) ; return redirect ( 'tunjangan' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//