/** * Creates a new connection * * @return void **/ public function newconnection() { $connection = Connection::blank(); $connection->set(['project_id' => $this->model->get('id'), 'provider_id' => Request::getInt('provider_id')])->save(); // Redirect App::redirect(Route::url($this->model->link('files') . '&action=editconnection&connection=' . $connection->id, false)); }
/** * Creates a new connection * * @return void **/ public function saveconnection() { $data = Request::getVar('connect', array(), 'post'); $data['owner_id'] = User::get('id'); if (Request::getInt('shareconnection', 0, 'post')) { $data['owner_id'] = 0; } $connection = Connection::blank(); $connection->set($data); if (is_array($connection->get('params'))) { $connection->set('params', json_encode($connection->get('params'))); } if (!$connection->save()) { App::redirect(Route::url($this->model->link('files'), false), $connection->getError(), 'error'); } // Redirect App::redirect(Route::url($this->model->link('files'), false)); }