public function create() { $this->user = User::find($this->params()->user_id); if ($this->request()->isPost()) { if ($this->user->id == $this->current_user->id) { $this->notice("You cannot create a record for yourself"); } else { $this->user_record = UserRecord::create(array_merge($this->params()->user_record, ['user_id' => $this->params()->user_id, 'reported_by' => $this->current_user->id])); $this->notice("Record updated"); } $this->redirectTo(["#index", 'user_id' => $this->user->id]); } }
protected function _save_to_record() { UserRecord::create(['user_id' => $this->user_id, 'reported_by' => $this->banned_by, 'is_positive' => false, 'body' => "Blocked: " . $this->reason]); }