Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * @param Arrayable $arrayable
  */
 protected function setEventData(Arrayable $arrayable)
 {
     $this->eventData = $arrayable->toArray();
 }
Exemplo n.º 3
0
 /**
  * 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;
 }
Exemplo n.º 4
0
 /**
  * Create a 200 - OK response
  * @param Arrayable $data
  * @return Response
  */
 public function responseOk(Arrayable $data)
 {
     return response($data->toArray(), Response::HTTP_OK);
 }
Exemplo n.º 5
0
 /**
  * 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;
 }