当前位置: 首页>>代码示例>>PHP>>正文


PHP Review::save方法代码示例

本文整理汇总了PHP中Review::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Review::save方法的具体用法?PHP Review::save怎么用?PHP Review::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Review的用法示例。


在下文中一共展示了Review::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: review

 public function review(Request $request, $id)
 {
     $validation = Validator::make($request->all(), ['rating' => 'required|between:1,10', 'title' => 'required|min:5', 'description' => 'required|min:5']);
     if ($validation->fails()) {
         return redirect('dvds/' . $id)->withInput()->withErrors($validation);
     }
     $review = new Review(['rating' => $request->input('rating'), 'title' => $request->input('title'), 'description' => $request->input('description'), 'dvd_id' => $id]);
     $review->save();
     return redirect('dvds/' . $id)->with('success', true);
 }
开发者ID:deirinberg,项目名称:itp405-spring2016-laravel,代码行数:10,代码来源:DVDController.php

示例2: actionCreate

 public function actionCreate()
 {
     $model = new Review();
     if (isset($_POST['Review'])) {
         $model->attributes = $_POST['Review'];
         if ($model->validate() && $model->save()) {
             $this->redirect(array('index'));
         }
     }
     $statuses = array(0 => Yii::t('common', 'Disabled'), 1 => Yii::t('common', 'Enabled'));
     $this->render('create', array('model' => $model, 'statuses' => $statuses));
 }
开发者ID:damnpoet,项目名称:yiicart,代码行数:12,代码来源:ReviewsController.php

示例3: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Review();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Review'])) {
         $model->attributes = $_POST['Review'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:kjunangle,项目名称:Web-App-engineer,代码行数:17,代码来源:ReviewController.php

示例4: actionCreate

 /**
  * 录入
  *
  */
 public function actionCreate()
 {
     parent::_acl();
     $model = new Review();
     if (isset($_POST['Review'])) {
         $acl = $this->_gets->getPost('acl');
         $model->attributes = $_POST['Review'];
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入内容,ID:' . $model->id));
             $this->redirect(array('index'));
         }
     }
     $this->render('review_create', array('model' => $model));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:18,代码来源:ReviewController.php

示例5: grabber

 public function grabber(array $directory_user)
 {
     log_message('TASK_DEBUG', __FUNCTION__ . ' > ' . 'Reviews grabber');
     try {
         $directoryUser = new Directory_User($directory_user['id']);
         if (!$directoryUser->exists()) {
             throw new Exception('Directory_User id:' . $directory_user['id'] . ' doesn\'t exist');
         }
         $directory = $directoryUser->directory->get();
         if (!$directory->exists()) {
             throw new Exception('Directory id:' . $directory_user['directory_id'] . ' doesn\'t exist');
         }
         if (!$directory->status) {
             throw new Exception('Directory id:' . $directory_user['directory_id'] . ' is disabled');
         }
         $link = !empty($directory_user['additional']) ? $directory_user['additional'] : $directory_user['link'];
         log_message('TASK_DEBUG', __FUNCTION__ . ' > ' . 'Try to grabb - ' . $directory->name);
         $aac = $this->getAAC();
         $user = new User($directory_user['user_id']);
         if (!$user->exists()) {
             return;
         }
         $aac->setUser($user);
         $directory_parcer = Directory_Parser::factory($directory->type)->set_url($link);
         $reviews = $directory_parcer->get_reviews();
         /**
          * Store additional data to
          */
         if ($directory_parcer instanceof Directory_Interface_UserStorage) {
             $directoryUser->setAdditional($directory_parcer->getDataToStore())->save();
         }
     } catch (Exception $e) {
         log_message('TASK_ERROR', __FUNCTION__ . ' > ' . 'Reviews: ' . $e->getMessage());
         throw $e;
     }
     //$today_midnight = strtotime('-7 day midnight');
     $today_midnight = strtotime('-14 day midnight');
     if (is_array($reviews) && !empty($reviews)) {
         foreach ($reviews as $_review) {
             $review_model = new Review();
             $review_model->from_array($_review);
             $review_model->user_id = $directory_user['user_id'];
             $review_model->directory_id = $directory_user['directory_id'];
             $review_model->profile_id = $directory_user['profile_id'];
             $review_model->posted_date = date('Y-m-d', $_review['posted']);
             $review_model->save();
             log_message('TASK_DEBUG', __FUNCTION__ . ' > ' . 'Review saved');
         }
     }
 }
开发者ID:andrewkrug,项目名称:repucaution,代码行数:50,代码来源:reviews_task.php

示例6: Review

 function test_getAll()
 {
     //Arrange
     $review = "Pizza was dope";
     $restaurant_id = 1;
     $test_review = new Review($review, $restaurant_id);
     $test_review->save();
     $review2 = "DAMN DAT GRILLED CHEESE IS FIRE";
     $restaurant_id2 = 2;
     $test_review2 = new Review($review2, $restaurant_id2);
     $test_review2->save();
     //Act
     $result = Review::getAll();
     //Assert
     $this->assertEquals([$test_review, $test_review2], $result);
 }
开发者ID:kellimargaret,项目名称:restaurants,代码行数:16,代码来源:ReviewTest.php

示例7: actionAdd

 public function actionAdd()
 {
     $model = new Review();
     $model->unsetAttributes();
     $model->user_id = $this->user->id;
     $model->date = time();
     if (isset($_POST['Review'])) {
         $model->attributes = $_POST['Review'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', '新加评价成功');
             $this->redirect(array('/board/review/index'));
         }
     }
     $model->formatDate();
     $this->render('edit', array('model' => $model));
 }
开发者ID:sunshy360,项目名称:cubingchina,代码行数:16,代码来源:ReviewController.php

示例8: Review

 function render_for_post()
 {
     if (empty(PA::$login_user)) {
         return __("Login required");
     }
     $rev = new Review();
     $rev->author_id = PA::$login_user->user_id;
     $rev->subject_type = $this->params["subject_type"];
     $rev->subject_id = $this->params["subject_id"];
     //TODO: validate subject_type and subject_id
     $rev->title = $this->params["title"];
     $rev->body = $this->params["body"];
     //TODO: ensure html is stripped properly
     $rev->save();
     return $this->render();
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:16,代码来源:ReviewModule.php

示例9: postIndex

 /**
  * Display a listing of destinos
  *
  * @return Response
  */
 public function postIndex()
 {
     $input = Input::all();
     if (!empty($input)) {
         $review = new Review();
         $review->cliente_id = Auth::user()->id;
         $review->produto_id = $input['produto_id'];
         $review->titulo = $input['review-titulo'];
         $review->texto = $input['review-texto'];
         $review->nota = $input['review-nota'];
         $review->save();
         return Redirect::back()->with('success', array('Sua avaliação foi enviada e em breve sera analisada.'));
     } else {
         return Redirect::back()->with('danger', array('preencha todos os campos da avaliação.'));
     }
 }
开发者ID:WillyMaciel,项目名称:fwt,代码行数:21,代码来源:ReviewController.php

示例10: actionView

 public function actionView($id)
 {
     $teacher = $this->loadModel($id);
     $this->_seoTitle = '名师 - ' . $teacher->name;
     $userId = $this->_cookiesGet('userId');
     $userType = $this->_cookiesGet('userType');
     $reviewModel = new Review();
     if ($userType === 'student' and isset($_POST['Review'])) {
         $reviewModel->attributes = $_POST['Review'];
         $reviewModel->teacher_id = $id;
         $reviewModel->student_id = $userId;
         $reviewModel->ctime = time();
         if ($reviewModel->validate() and $reviewModel->save()) {
             Yii::app()->user->setFlash('success', '保存成功');
         }
     }
     $criteria = new CDbCriteria();
     $books = Book::model()->findAllByAttributes(array('teacher_id' => $id));
     $lessons = array();
     $reviews = array();
     $list = yii::app()->request->getParam('list');
     if ($list === null or $list === 'lesson') {
         $model = Lesson::model();
         $count = $model->count($criteria->addCondition("teacher_id = {$id}"));
         $pager = new CPagination($count);
         $pager->pageSize = 4;
         $pager->applyLimit($criteria);
         $lessons = $model->findAll($criteria);
     } else {
         $model = Review::model();
         $count = $model->count($criteria->addCondition("teacher_id = {$id}"));
         $pager = new CPagination($count);
         $pager->pageSize = 4;
         $pager->applyLimit($criteria);
         $reviews = Yii::app()->db->createCommand()->select('s.*, r.contents, r.ctime')->from('seed_review r')->leftjoin('seed_student s', 's.id=r.student_id')->where('r.teacher_id=:teacher_id', array(':teacher_id' => $id))->order('ctime desc')->limit(4, $pager->currentPage * $pager->pageSize)->queryAll();
     }
     //判断学员已关注老师
     if ($userType === 'student') {
         $is_focus = StudentTeacher::model()->findByAttributes(array('student_id' => $userId, 'teacher_id' => $id));
     }
     $this->render('view', array('is_focus' => $is_focus, 'teacher' => $teacher, 'lessons' => $lessons, 'reviews' => $reviews, 'books' => $books, 'userType' => $userType, 'reviewModel' => $reviewModel, 'count' => $count, 'pager' => $pager, 'list' => $_GET['list']));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:42,代码来源:TeacherController.php

示例11: actionReplySave

 public function actionReplySave()
 {
     $model = new Review();
     if (isset($_POST['text'])) {
         $model->create_at = time();
         $model->content = $_POST['text'];
         $model->customer_id = Yii::app()->user->id;
         $model->entity_id = 2;
         $model->entity_pk_value = $_POST['customerId'];
         if ($model->customer_id != '') {
             if ($model->save()) {
                 return ture;
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:lhfcainiao,项目名称:basic,代码行数:20,代码来源:DefaultController.php

示例12: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     //echo $this->loadModel($_GET['id']);
     // exit();
     //
     $model = Review::model()->findByAttributes(array('tmvdb_id' => $_GET['id']));
     //
     if ($model == null) {
         $model = new Review();
     }
     //                $model=new Review;
     //            }
     //print_r ($model);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Review'])) {
         $model->attributes = $_POST['Review'];
         if ($model->save()) {
             $this->redirect('../site/index');
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:kjunangle,项目名称:Web-App-engineer,代码行数:27,代码来源:ReviewController.php

示例13: actionCreate

 public function actionCreate()
 {
     $model = new Review();
     if (isset($_POST['rating1'], $_POST['product_id'])) {
         $rId = $this->addRate($_POST['rating1'], $_POST['product_id']);
     }
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['review_title'])) {
         $model->review_title = $_POST['review_title'];
         $model->review_content = $_POST['review_content'];
         $model->product_id = $_POST['product_id'];
         //echo $id; die();
         //                        $ratingIdfromSaveRating=new CHttpSession;
         //                        $ratingIdfromSaveRating->open();
         if ($rId) {
             $model->rating_id = $rId;
             // strip_tags($ratingIdfromSaveRating['rating_id']);
             $model->user_id = Yii::app()->user->user_id;
             //$model->attributes=$_POST['Review'];
             if ($model->save()) {
                 // echo var_dump($model); die();
             } else {
                 die(var_dump($model->getErrors()));
             }
             //echo 'not in'; die();
             //				$this->redirect(array('view','id'=>$model->review_id));
         }
     }
     $this->render('create', array('model' => $model, 'productId' => $model->product_id));
 }
开发者ID:indresh90,项目名称:utopeen_webpeoduct,代码行数:31,代码来源:ReviewController.php

示例14: Cuisine

 function test_deleteReviews()
 {
     $name = "Asian";
     $id = null;
     $test_cuisine = new Cuisine($name, $id);
     $test_cuisine->save();
     $restaurant_name = "The Golden Duck";
     $location = "898 SW 5th Ave, Portland, OR";
     $description = "A Chill Asian experince";
     $price = "\$\$";
     $cuisine_id = $test_cuisine->getId();
     $test_restaurant = new Restaurant($restaurant_name, $location, $description, $price, $cuisine_id);
     $test_restaurant->save();
     $restaurant_name2 = "The Red Dragon";
     $location2 = "899 SW 5th Ave, Portland, OR";
     $description2 = "A Intense Asian experince";
     $price2 = "\$\$\$";
     $cuisine_id2 = $test_cuisine->getId();
     $test_restaurant2 = new Restaurant($restaurant_name2, $location2, $description2, $price2, $cuisine_id2);
     $test_restaurant2->save();
     $user = "yoloswag1959";
     $stars = 3;
     $headline = "It is aight.";
     $body = "Yeah, pretty aight bro";
     $restaurant_id = $test_restaurant->getId();
     $test_review = new Review($user, $stars, $headline, $body, $restaurant_id);
     $test_review->save();
     $user2 = "6969babygirl";
     $stars2 = 3;
     $headline2 = "XOXO";
     $body2 = "I cant even";
     $restaurant_id2 = $test_restaurant->getId();
     $test_review2 = new Review($user2, $stars2, $headline2, $body2, $restaurant_id2);
     $test_review2->save();
     $test_restaurant->delete();
     $result = Review::getAll();
     //var_dump($result);
     $this->assertEquals([], $result);
 }
开发者ID:juliocesardiaz,项目名称:Best-restaurants,代码行数:39,代码来源:RestaurantTest.php

示例15: Bathroom

 function test_getReviews()
 {
     $unisex = 0;
     $key_required = 0;
     $public = 0;
     $handicap = 0;
     $changing_table = 0;
     $marker_id = 2;
     $test_bathroom = new Bathroom($unisex, $key_required, $public, $handicap, $changing_table, $marker_id);
     $test_bathroom->save();
     $rating = 1;
     $comment = "This place sucks!";
     $test_review = new Review($rating, $comment);
     $test_review->save();
     $rating2 = 3;
     $comment2 = "Its aight!";
     $test_review2 = new Review($rating2, $comment2);
     $test_review2->save();
     $test_bathroom->addReview($test_review->getId());
     $test_bathroom->addReview($test_review2->getId());
     $result = $test_bathroom->getReviews();
     $this->assertEquals([$test_review, $test_review2], $result);
 }
开发者ID:jeffaustin81,项目名称:tinklr-dev,代码行数:23,代码来源:BathroomTest.php


注:本文中的Review::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。