src/Time.php
public function insert(array $data)
    {
        $id = 0;
        if (!empty($data['task_id'])) {
            $id = (int) $data['task_id'];
            $resource = 'todo_items';
        } elseif (!empty($data['project_id'])) {
            $id = (int) $data['project_id'];
            $resource = 'projects';
        }
        if ($id <= 0) {
            throw new Exception('Required field project_id or task_id');
        }
        return $this->rest->post("$resource/$id/$this->action", $data);
    }
public function insert(array $data)
    {
        $id = 0;
        if (!empty($data['task_id'])) {
            $id = (int) $data['task_id'];
            $resource = 'todo_items';
        } elseif (!empty($data['project_id'])) {
            $id = (int) $data['project_id'];
            $resource = 'projects';
        }
        if ($id <= 0) {
            throw new Exception('Required field project_id or task_id');
        }
        return $this->rest->post("$resource/$id/$this->action", $data);
    }
public function insert ( array $ data ) { $ id = 0 ; if ( ! empty ( $ data [ 'task_id' ] ) ) { $ id = ( int ) $ data [ 'task_id' ] ; $ resource = 'todo_items' ; } elseif ( ! empty ( $ data [ 'project_id' ] ) ) { $ id = ( int ) $ data [ 'project_id' ] ; $ resource = 'projects' ; } if ( $ id <= 0 ) { throw new Exception ( 'Required field project_id or task_id' ) ; } return $ this -> rest -> post ( "$resource/$id/$this->action" , $ data ) ; }
Inserta un time entry ya sea para
un projecto o para un todo item

@param array $data

@return int
@throws \TeamWorkPm\Exception
Inserta un time entry ya sea para un projecto o para un todo item