public function save(array $options = []) { if (empty($this->public_key) || empty($this->private_key)) { $this->generateKeys(); } return parent::save($options); }
/** * Save the model to the database. * * @param array $options * @return bool */ public function save(array $options = []) { // If only a date of resolution is set, assume it's successful. if ($this->date_resolved && !$this->resolution_id) { $this->resolution_id = JobResolution::SUCCEEDED; } parent::save($options); }
public function __get($key) { static $collections = ['speakers', 'sponsors', 'communitySponsors', 'talks', 'rooms', 'hotels', 'jobs', 'individualSponsors']; if (in_array($key, $collections, true)) { $data = $this->database->get($key); foreach ($data as &$item) { $item = new Model($item, $this->database); } return new Collection($data); } return parent::__get($key); }
/** * @return array */ public function toArray() { return parent::toArray() + ['inventories' => $this->inventories, 'users' => $this->users, 'hookUrl' => config('app.url') . action('HookController@pull', [$this->id], false)]; }
function __construct() { parent::__construct(); }
public function index() { $model = new Model(); $view = new Principal(); $view->mostrar($model->get()); }
public function toArray() { return parent::toArray() + ["remote" => sprintf("%s/git/%s/%s", env('APP_URL'), $this->repo->id, $this->name)]; }
/** * @return array */ public function getDates() { return array_merge(parent::getDates(), ['started_at']); }
/** * @param string $attr * @param string $value * @param string $attrs * @return bool|Nette\Database\IRow|Nette\Database\Row */ public function findBy($attr, $value, $attrs = 'id, username, email, first_name, last_name, password, role') { return parent::findBy($attr, $value, $attrs); }