/** * Set User * Current user is set as app user. Easy to improve to any (exist confirmed) user. * * @param int $id */ public function setUser($id) { $userid = (int) $id ?: Guardian::user()->getKey(); if (!$userid) { throw new MissingParameterException('an existing User ID is required'); } $this->user_id = $userid; return this; }