/** For the bot **/
 public function review($reviewId)
 {
     $reviewModel = new Review();
     $filmModel = new Film();
     $review['review'] = $reviewModel->where('review_id', '=', $reviewId)->first()->toArray();
     $review['film'] = $filmModel->where('id', '=', $review['review']['id'])->first()->toArray();
     $data['review'] = $review;
     return view('review', $data);
 }
示例#2
0
 private function _getFilmForReview()
 {
     // We'll retrieve popular films (based on the num of votes)
     $randIndex = rand(1, 500);
     $film = Film::where('rating', '>=', '7')->orderBy('num_votes', 'desc')->skip($randIndex)->first();
     return $film;
 }
示例#3
0
 /**
  * Create or update a post.
  *
  * @param App\Models\Film $film        	
  * @param array $inputs        	
  * @param bool $user_id        	
  * @return App\Models\Film
  */
 private function savePost($film, $inputs, $user_id = null)
 {
     $film->title = $inputs['title'];
     $film->summary = $inputs['summary'];
     $film->slug = $inputs['slug'];
     $film->sub_cat_id = $inputs['sub_cat_id'];
     /* phim duoc su dung hay ko */
     $film->publish = isset($inputs['publish']);
     /* la phim noi bat hay ko */
     $film->isHot = isset($inputs['isHot']);
     /* phim mien phi hay ko */
     $film->isFree = isset($inputs['isFree']);
     /* poster image */
     if (!empty($inputs['poster_path'])) {
         $film->poster_path = str_replace("/filemanager", "", $inputs['poster_path']);
     }
     /* film path */
     if (!empty($inputs['film_path'])) {
         $film->film_path = str_replace("/filemanager", "", $inputs['film_path']);
     }
     /* subtitle path */
     if (!empty($inputs['subtitle_path'])) {
         $film->subtitle_path = str_replace("/filemanager", "", $inputs['subtitle_path']);
     }
     /* dao dien */
     if (isset($inputs['director'])) {
         $film->director = $inputs['director'];
     }
     /* Dien vien */
     if (isset($inputs['actor'])) {
         $film->actor = $inputs['actor'];
     }
     /* Ngay phat hanh */
     if (isset($inputs['release_date'])) {
         $film->release_date = $inputs['release_date'];
     }
     /* thoi luong phim */
     if (isset($inputs['running_time'])) {
         $film->running_time = $inputs['running_time'];
     }
     /* so luong tap phim */
     if (isset($inputs['num'])) {
         $film->num = $inputs['num'];
     }
     /* tap thu may */
     if (isset($inputs['episode'])) {
         $film->episode = $inputs['episode'];
     }
     /* ngon ngu  */
     if (isset($inputs['language'])) {
         $film->language = $inputs['language'];
     }
     /* phim lien quan  */
     if (isset($inputs['first_episode_id'])) {
         $film->first_episode_id = $inputs['first_episode_id'];
     }
     /* so diem cham */
     if (isset($inputs['star'])) {
         $film->star = $inputs['star'];
     }
     //$cat->cat_id = $inputs ['cat_id'];
     if ($user_id) {
         $film->user_id = $user_id;
     }
     $film->save();
     //neu khong nhap phim lien quan, mac dinh phim nay lien quan den chinh no
     $film->first_episode_id = $film->id;
     $film->update();
     SearchIndexFacade::upsertToIndex($film);
     return $film;
 }
示例#4
0
 private function _buildResultSingle($type, $name, $filmIds)
 {
     $result['type'] = $type;
     $result['type_string'] = $this->_getStringFromType($type);
     $result['name'] = $name;
     $result['url'] = url() . "/" . $type[0] . "/" . str_replace(" ", "_", $name);
     $result['films'] = array();
     if (isset($filmIds) && $filmIds) {
         $result['films'] = Film::orderBy('rating', 'desc')->find($filmIds)->toArray();
     }
     $result['text_twitter'] = "Las mejores películas de " . $name . " | Project by @ojoven, powered by Filmaffinity";
     $result['text_facebook'] = "Las mejores películas de " . $name . " | Powered by Filmaffinity";
     return $result;
 }
示例#5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFilms()
 {
     return $this->hasMany(Film::className(), ['project_type' => 'id']);
 }