public function getAttribute($key)
    {
        // Sanitize the key
        $key = preg_replace('/^_/', '', $key);

        // Decoder ring for legacy keys
        switch ($key) {
            case 'size':
                $key = 'file_size';
                break;
            case 'filename':
            case 'original_filename':
                $key = 'file_name';
                break;
        }

        return $this->getInstance()
            ->getAttribute("{$this->name}_{$key}");
    }
public function getAttribute($key)
    {
        // Sanitize the key
        $key = preg_replace('/^_/', '', $key);

        // Decoder ring for legacy keys
        switch ($key) {
            case 'size':
                $key = 'file_size';
                break;
            case 'filename':
            case 'original_filename':
                $key = 'file_name';
                break;
        }

        return $this->getInstance()
            ->getAttribute("{$this->name}_{$key}");
    }
public function getAttribute ( $ key ) { // Sanitize the key $ key = preg_replace ( '/^_/' , '' , $ key ) ; // Decoder ring for legacy keys switch ( $ key ) { case 'size' : $ key = 'file_size' ; break ; case 'filename' : case 'original_filename' : $ key = 'file_name' ; break ; } return $ this -> getInstance ( ) -> getAttribute ( "{$this->name}_{$key}" ) ; }
Return the attachment attribute value.

@param string $key

@return mixed
Return the attachment attribute value .