Пример #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $aturan = array('kode_inventory' => 'required', 'nama_inventory' => 'required', 'deskripsi' => 'required');
     $validasi = Validator::make(Input::all(), $aturan);
     if ($validasi->fails()) {
         return Redirect::to('inventory/create')->withErrors($validasi)->withInput();
     } else {
         $inventory = new InventoryModel();
         $inventory->kode_inventory = Input::get('kode_inventory');
         $inventory->nama_inventory = Input::get('nama_inventory');
         $inventory->deskripsi = Input::get('deskripsi');
         $inventory->save();
         // notif
         Session::flash('message', 'data di simpan');
         // reditect
         return Redirect::to('inventory');
     }
 }