コード例 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     // membuat object baru dari Penghargaan() dengan input nama_penghargaan
     $penghargaan = new Penghargaan();
     $penghargaan->nama_penghargaan = Input::get('nama_penghargaan');
     // bila proses memasukan data berhasil maka akan mengirimkan response dalam bentuk json
     if ($penghargaan->save()) {
         return Response::json(array('success' => TRUE));
     }
 }
コード例 #2
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Penghargaan();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Penghargaan'])) {
         $model->attributes = $_POST['Penghargaan'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id_penghargaan));
         }
     }
     $this->render('create', array('model' => $model));
 }