protected function maybeMakeResource($type, $data, $status = 200) {
        $resourceName = $type . 'Resource';
        if(isset($this->$resourceName) && $this->$resourceName) {
            $class = $this->$resourceName;
            return (new $class($data))->response()
            ->setStatusCode($status);
        } elseif(is_bool($data)){
            return strval($data);
        } else {
            return $data;
        }
    }
protected function maybeMakeResource($type, $data, $status = 200) {
        $resourceName = $type . 'Resource';
        if(isset($this->$resourceName) && $this->$resourceName) {
            $class = $this->$resourceName;
            return (new $class($data))->response()
            ->setStatusCode($status);
        } elseif(is_bool($data)){
            return strval($data);
        } else {
            return $data;
        }
    }
protected function maybeMakeResource ( $ type , $ data , $ status = 200 ) { $ resourceName = $ type . 'Resource' ; if ( isset ( $ this -> $ resourceName ) && $ this -> $ resourceName ) { $ class = $ this -> $ resourceName ; return ( new $ class ( $ data ) ) -> response ( ) -> setStatusCode ( $ status ) ; } elseif ( is_bool ( $ data ) ) { return strval ( $ data ) ; } else { return $ data ; } }
If is defined return a Api Resource object

@param string $type
@param collection $data
@return Resource | Model
If is defined return a Api Resource object