Illuminate\Support\Collection::implode PHP Method

implode() public method

Concatenate values of a given key as a string.
public implode ( string $value, string $glue = null ) : string
$value string
$glue string
return string
    public function implode($value, $glue = null)
    {
        $first = $this->first();
        if (is_array($first) || is_object($first)) {
            return implode($glue, $this->pluck($value)->all());
        }
        return implode($value, $this->items);
    }

Usage Example

Exemplo n.º 1
0
 protected function makeDistributedName()
 {
     $this->md5FileName = md5($this->getModel()->path . microtime(true)) . '.' . collect(explode('.', $this->getModel()->path))->last();
     $this->getModel()->old_name = $this->getModel()->path;
     $this->distributedPathCollection = collect([mb_substr($this->md5FileName, 0, 3), mb_substr($this->md5FileName, 3, 3), mb_substr($this->md5FileName, 6, 3)]);
     $this->getModel()->name = mb_substr($this->md5FileName, 9);
     $this->getModel()->distributed_path = $this->distributedPathCollection->implode($this->pathSeparator);
     $this->getModel()->path = $this->getModel()->distributed_path . $this->pathSeparator . $this->getModel()->name;
     return $this;
 }
All Usage Examples Of Illuminate\Support\Collection::implode