/** * Convert input to actual array. * * @param array|\Illuminate\Contracts\Support\Arrayable $array * * @return array */ protected function asArray($array) { return $array instanceof Arrayable ? $array->toArray() : $array; }
/** * @param Arrayable $arrayable */ protected function setEventData(Arrayable $arrayable) { $this->eventData = $arrayable->toArray(); }
/** * Morph a value to an array. * * @param array|\Illuminate\Contracts\Support\Arrayable $value * * @return array */ protected function morphToArray($value) { return $value instanceof Arrayable ? $value->toArray() : $value; }
/** * Create a 200 - OK response * @param Arrayable $data * @return Response */ public function responseOk(Arrayable $data) { return response($data->toArray(), Response::HTTP_OK); }
/** * Get the instance as an array. * * @return array */ public function toArray() { return $this->object->toArray(); }
/** * Blindly creates new post from Arrayable object * * @param Arrayable $command * @return Comment */ public function fromArray(Arrayable $command) { $post = new Comment($command->toArray()); $post->raise(new MemberHasRespondedWithComment($post)); return $post; }