private function setNewFilename($newfilename = null)
    {
        $extension = $this->results['original_extension'];
        $originalFilename = $this->results['original_filename'];

        $timestamp = Carbon::now()->getTimestamp();

        switch ($this->newfilename) {
            case 'hash':
                $newfilename = md5($originalFilename.$timestamp);
                break;
            case 'random':
                $newfilename = Str::random(16);
                break;
            case 'timestamp':
                $newfilename = $timestamp;
                break;
            case 'custom':
                $newfilename = (! empty($newfilename) ? $newfilename : $originalFilename);
                break;
            default:
                $newfilename = pathinfo($originalFilename, PATHINFO_FILENAME);
        }

        $this->results['basename'] = (string) $newfilename;
        $this->results['filename'] = $newfilename.'.'.$extension;

        return $this;
    }
private function setNewFilename($newfilename = null)
    {
        $extension = $this->results['original_extension'];
        $originalFilename = $this->results['original_filename'];

        $timestamp = Carbon::now()->getTimestamp();

        switch ($this->newfilename) {
            case 'hash':
                $newfilename = md5($originalFilename.$timestamp);
                break;
            case 'random':
                $newfilename = Str::random(16);
                break;
            case 'timestamp':
                $newfilename = $timestamp;
                break;
            case 'custom':
                $newfilename = (! empty($newfilename) ? $newfilename : $originalFilename);
                break;
            default:
                $newfilename = pathinfo($originalFilename, PATHINFO_FILENAME);
        }

        $this->results['basename'] = (string) $newfilename;
        $this->results['filename'] = $newfilename.'.'.$extension;

        return $this;
    }
private function setNewFilename ( $ newfilename = null ) { $ extension = $ this -> results [ 'original_extension' ] ; $ originalFilename = $ this -> results [ 'original_filename' ] ; $ timestamp = Carbon :: now ( ) -> getTimestamp ( ) ; switch ( $ this -> newfilename ) { case 'hash' : $ newfilename = md5 ( $ originalFilename . $ timestamp ) ; break ; case 'random' : $ newfilename = Str :: random ( 16 ) ; break ; case 'timestamp' : $ newfilename = $ timestamp ; break ; case 'custom' : $ newfilename = ( ! empty ( $ newfilename ) ? $ newfilename : $ originalFilename ) ; break ; default : $ newfilename = pathinfo ( $ originalFilename , PATHINFO_FILENAME ) ; } $ this -> results [ 'basename' ] = ( string ) $ newfilename ; $ this -> results [ 'filename' ] = $ newfilename . '.' . $ extension ; return $ this ; }
Set new file name from config.

@access private
@param string $newfilename (default: null)
Set new file name from config .