public function update($files, $payload)
    {
        if (isset($payload['location'])) {
            $savedFile = app(FileService::class)->saveFile($payload['location'], 'files/');
            $_file = $payload['location'];

            $filePayload = $payload;
            $filePayload['name'] = $savedFile['original'];
            $filePayload['location'] = $savedFile['name'];
            $filePayload['mime'] = $_file->getClientMimeType();
            $filePayload['size'] = $_file->getClientSize();
        } else {
            $filePayload = $payload;
        }

        $filePayload['is_published'] = (isset($payload['is_published'])) ? (bool) $payload['is_published'] : 0;

        return $files->update($filePayload);
    }
public function update($files, $payload)
    {
        if (isset($payload['location'])) {
            $savedFile = app(FileService::class)->saveFile($payload['location'], 'files/');
            $_file = $payload['location'];

            $filePayload = $payload;
            $filePayload['name'] = $savedFile['original'];
            $filePayload['location'] = $savedFile['name'];
            $filePayload['mime'] = $_file->getClientMimeType();
            $filePayload['size'] = $_file->getClientSize();
        } else {
            $filePayload = $payload;
        }

        $filePayload['is_published'] = (isset($payload['is_published'])) ? (bool) $payload['is_published'] : 0;

        return $files->update($filePayload);
    }
public function update ( $ files , $ payload ) { if ( isset ( $ payload [ 'location' ] ) ) { $ savedFile = app ( FileService :: class ) -> saveFile ( $ payload [ 'location' ] , 'files/' ) ; $ _file = $ payload [ 'location' ] ; $ filePayload = $ payload ; $ filePayload [ 'name' ] = $ savedFile [ 'original' ] ; $ filePayload [ 'location' ] = $ savedFile [ 'name' ] ; $ filePayload [ 'mime' ] = $ _file -> getClientMimeType ( ) ; $ filePayload [ 'size' ] = $ _file -> getClientSize ( ) ; } else { $ filePayload = $ payload ; } $ filePayload [ 'is_published' ] = ( isset ( $ payload [ 'is_published' ] ) ) ? ( bool ) $ payload [ 'is_published' ] : 0 ; return $ files -> update ( $ filePayload ) ; }
Updates Files into database.

@param Files $files
@param array $payload

@return Files
Updates Files into database .