protected function asArray($data = []): array
    {
        if ($data instanceof Collection) {
            $data = $data->all();
        } elseif ($data instanceof Arrayable) {
            $data = $data->toArray();
        }

        return $data;
    }
protected function asArray($data = []): array
    {
        if ($data instanceof Collection) {
            $data = $data->all();
        } elseif ($data instanceof Arrayable) {
            $data = $data->toArray();
        }

        return $data;
    }
protected function asArray ( $ data = [ ] ) : array { if ( $ data instanceof Collection ) { $ data = $ data -> all ( ) ; } elseif ( $ data instanceof Arrayable ) { $ data = $ data -> toArray ( ) ; } return $ data ; }
Convert mixed value fetch from database to array.

@param  \Illuminate\Support\Collection|\Illuminate\Contracts\Support\Arrayable|array  $data

@return array
Convert mixed value fetch from database to array .