app/Http/Resources/UserChatMessageResource.php
/**
     * Transform the resource into an array.
     *
     * @param  Request  $request
     * @return array
     */
Transform the resource into an array.
@param  Request  $request
@return array
Transform the resource into an array . @param Request $request @return array
public function toArray($request)
    {
        return [
            'id' => $this->id,
            'userFromId' => $this->user_id_from,
            'userToId' => $this->user_id_to,
            'message' => nl2br(urlFromString(strip_tags($this->body))),
            'createdAt' => formatDate($this->created_at)
        ];
    }
public function toArray ( $ request ) { return [ 'id' => $ this -> id , 'userFromId' => $ this -> user_id_from , 'userToId' => $ this -> user_id_to , 'message' => nl2br ( urlFromString ( strip_tags ( $ this -> body ) ) ) , 'createdAt' => formatDate ( $ this -> created_at ) ] ; }
Transform the resource into an array.
Transform the resource into an array .