Codesleeve\Stapler\Attachment::contentType PHP Method

contentType() public method

Lives in the _content_type attribute of the model.
public contentType ( ) : string
return string
    public function contentType()
    {
        return $this->instance->getAttribute("{$this->name}_content_type");
    }

Usage Example

Example #1
0
 /**
  * Move an uploaded file to it's intended destination.
  *
  * @param  string $file
  * @param  string $filePath
  */
 public function move($file, $filePath)
 {
     $objectConfig = $this->attachedFile->s3_object_config;
     $fileSpecificConfig = ['Key' => $filePath, 'SourceFile' => $file, 'ContentType' => $this->attachedFile->contentType()];
     $mergedConfig = array_merge($objectConfig, $fileSpecificConfig);
     $this->ensureBucketExists($mergedConfig['Bucket']);
     $this->s3Client->putObject($mergedConfig);
 }
All Usage Examples Of Codesleeve\Stapler\Attachment::contentType