示例#1
0
 /**
  * Creates a new Ruang model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Ruang();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $validasi = Validator::make($request->all(), Ruang::$rules, Ruang::$pesan);
     if ($validasi->fails()) {
         return Redirect::back()->withInput()->withErrors($validasi);
     } else {
         $ruang = new Ruang();
         $ruang->nama_ruang = $request->input('nama');
         $ruang->kuota = $request->input('kuota');
         $ruang->save();
         Session::flash('pesan', "Data Berhasil disimpan");
         return Redirect::to('admin/ruang');
     }
 }