public function moveUploadedFile(File $file, $path_pattern = null, $existing_model = null)
    {
        // get model instance if available
        // not use models if $existing_model === false

        $model_class = $this->getConfig('store.model');

        if (($model_class || $existing_model) && $existing_model !== false) {
            $model_instance = $existing_model ?: new $model_class();

            // cancel upload if event returned false

            if (!$model_instance->beforeUpload($file)) {
                return;
            }
        }

        $interpolated = parent::moveUploadedFile($file, $path_pattern);

        // check is model available
        // and update it

        if (isset($model_instance)) {
            return $this->saveModelData($model_instance, $interpolated);
        }

        return $interpolated;
    }
public function moveUploadedFile(File $file, $path_pattern = null, $existing_model = null)
    {
        // get model instance if available
        // not use models if $existing_model === false

        $model_class = $this->getConfig('store.model');

        if (($model_class || $existing_model) && $existing_model !== false) {
            $model_instance = $existing_model ?: new $model_class();

            // cancel upload if event returned false

            if (!$model_instance->beforeUpload($file)) {
                return;
            }
        }

        $interpolated = parent::moveUploadedFile($file, $path_pattern);

        // check is model available
        // and update it

        if (isset($model_instance)) {
            return $this->saveModelData($model_instance, $interpolated);
        }

        return $interpolated;
    }
public function moveUploadedFile ( File $ file , $ path_pattern = null , $ existing_model = null ) { // get model instance if available // not use models if $existing_model === false $ model_class = $ this -> getConfig ( 'store.model' ) ; if ( ( $ model_class || $ existing_model ) && $ existing_model !== false ) { $ model_instance = $ existing_model ? : new $ model_class ( ) ; // cancel upload if event returned false if ( ! $ model_instance -> beforeUpload ( $ file ) ) { return ; } } $ interpolated = parent :: moveUploadedFile ( $ file , $ path_pattern ) ; // check is model available // and update it if ( isset ( $ model_instance ) ) { return $ this -> saveModelData ( $ model_instance , $ interpolated ) ; } return $ interpolated ; }
Move uploaded file to path by pattern and update model.

@param File                                          $file
@param string|null                                   $path_pattern
@param Illuminate\Database\Eloquent\Model|null|false $existing_model

@return Illuminate\Database\Eloquent\Model|string|null
Move uploaded file to path by pattern and update model .