/** * Adds given title to given list of user. * * @param array $input * @return void */ public function add(array $input) { if ($user = Sentry::getUser()) { $data = array('user_id' => $user->id, 'title_id' => $input['title_id'], $input['list_name'] => 1); } $this->dbWriter->compileInsert('users_titles', $data)->save(); //fire eloquent saved event so cache is flushed Event::fire('eloquent.saved: *', new Title()); }
/** * Upload and associate image to title. * * @param array $input * @return void */ public function uploadImage(array $input) { $title = $this->model->find($input['title-id']); $name = str_random(25); $insert = array('local' => asset('assets/images/' . $name . '.jpg'), 'title_id' => $input['title-id']); $this->images->saveTitleImage($input, $name); $this->dbWriter->compileInsert('images', $insert)->save(); Event::fire('Titles.Modified', array($input['title-id'])); }
/** * Saves general information about actor (name, bio etc). * * @param mixed actor * @return void */ private function saveGenInfo($actor) { $gen = $actor->getGenInfo(); //set flags and temp id $temp = str_random(10); $gen['temp_id'] = $temp; $gen['fully_scraped'] = 1; //insert and get back id in database $this->dbWriter->compileInsert('actors', $gen)->save(); $this->modelId = $this->model->where('temp_id', $temp)->first()->id; }
/** * Attaches actor to title from given input. * * @param array $input * @return void */ private function attachActor(array $input) { //if we've got no actor id in input means we're //attaching a new actor to title so we need to //insert this actor into db first if (!isset($input['actor-id'])) { $actor = $this->insertActor($input['actor']); $input['actor-id'] = $actor->id; } $this->dbWriter->compileInsert('actors_titles', array('actor_id' => $input['actor-id'], 'title_id' => $input['title-id'], 'char_name' => $input['char']))->save(); }
/** * Saves reviews from user input. * * @param array $input * @return void */ public function save(array $input) { $input['source'] = trans('main.brand'); $this->dbWriter->compileInsert('reviews', $input)->save(); }
/** * Adds given title to given list of user. * * @param array $input * @return void */ public function add(array $input) { $data = array('user_id' => $input['user'], 'title_id' => $input['title'], $input['list'] => 1); $this->dbWriter->compileInsert('users_titles', $data)->save(); }