app/Http/Controllers/MasterController.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)
    {
       $messages = [
            'required' => 'Kolom :attribute tidak boleh kosong!',
            'date' => 'Kolom :attribute harus berupa tanggal!',
            'numeric' => 'Kolom :attribute harus berupa angka!'
        ];
        $validasi =$request->validate([
            'nama' =>'required',
            'jenis' => 'required'
        ],$messages);
        Dokumen::create($validasi);
        return redirect('/')->with('success', 'Data berhasil ditambahkan!');
    }
public function store ( Request $ request ) { $ messages = [ 'required' => 'Kolom :attribute tidak boleh kosong!' , 'date' => 'Kolom :attribute harus berupa tanggal!' , 'numeric' => 'Kolom :attribute harus berupa angka!' ] ; $ validasi = $ request -> validate ( [ 'nama' => 'required' , 'jenis' => 'required' ] , $ messages ) ; Dokumen :: create ( $ validasi ) ; return redirect ( '/' ) -> with ( 'success' , 'Data berhasil ditambahkan!' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .