original_string: public function file($server = '', $download = true)
      {
          $field = $this;
  
          return $this->unescape()->as(function ($path) use ($server, $download, $field) {
              $name = basename($path);
  
              $field->border = false;
  
              $size = $url = '';
  
              if (url()->isValidUrl($path)) {
                  $url = $path;
              } elseif ($server) {
                  $url = $server.$path;
              } else {
                  $storage = Storage::disk(config('admin.upload.disk'));
                  if ($storage->exists($path)) {
                      $url = $storage->url($path);
                      $size = ($storage->size($path) / 1000).'KB';
                  }
              }
  
              if (!$url) {
                  return '';
              }
  
              return <<<HTML
  <ul class="mailbox-attachments clearfix">
      <li style="margin-bottom: 0;">
        <span class="mailbox-attachment-icon"><i class="fa {$field->getFileIcon($name)}"></i></span>
        <div class="mailbox-attachment-info">
          <div class="mailbox-attachment-name">
              <i class="fa fa-paperclip"></i> {$name}
              </div>
              <span class="mailbox-attachment-size">
                {$size}&nbsp;
                <a href="{$url}" class="btn btn-default btn-xs pull-right" target="_blank"><i class="fa fa-cloud-download"></i></a>
              </span>
        </div>
      </li>
    </ul>
  HTML;
          });
      }
code: public function file($server = '', $download = true)
      {
          $field = $this;
  
          return $this->unescape()->as(function ($path) use ($server, $download, $field) {
              $name = basename($path);
  
              $field->border = false;
  
              $size = $url = '';
  
              if (url()->isValidUrl($path)) {
                  $url = $path;
              } elseif ($server) {
                  $url = $server.$path;
              } else {
                  $storage = Storage::disk(config('admin.upload.disk'));
                  if ($storage->exists($path)) {
                      $url = $storage->url($path);
                      $size = ($storage->size($path) / 1000).'KB';
                  }
              }
  
              if (!$url) {
                  return '';
              }
  
              return <<<HTML
  <ul class="mailbox-attachments clearfix">
      <li style="margin-bottom: 0;">
        <span class="mailbox-attachment-icon"><i class="fa {$field->getFileIcon($name)}"></i></span>
        <div class="mailbox-attachment-info">
          <div class="mailbox-attachment-name">
              <i class="fa fa-paperclip"></i> {$name}
              </div>
              <span class="mailbox-attachment-size">
                {$size}&nbsp;
                <a href="{$url}" class="btn btn-default btn-xs pull-right" target="_blank"><i class="fa fa-cloud-download"></i></a>
              </span>
        </div>
      </li>
    </ul>
  HTML;
          });
      }
code_tokens: public function file ( $ server = '' , $ download = true ) { $ field = $ this ; return $ this -> unescape ( ) -> as ( function ( $ path ) use ( $ server , $ download , $ field ) { $ name = basename ( $ path ) ; $ field -> border = false ; $ size = $ url = '' ; if ( url ( ) -> isValidUrl ( $ path ) ) { $ url = $ path ; } elseif ( $ server ) { $ url = $ server . $ path ; } else { $ storage = Storage :: disk ( config ( 'admin.upload.disk' ) ) ; if ( $ storage -> exists ( $ path ) ) { $ url = $ storage -> url ( $ path ) ; $ size = ( $ storage -> size ( $ path ) / 1000 ) . 'KB' ; } } if ( ! $ url ) { return '' ; } return  <<<HTML
  <ul class="mailbox-attachments clearfix">
      <li style="margin-bottom: 0;">
        <span class="mailbox-attachment-icon"><i class="fa {$field->getFileIcon($name)}"></i></span>
        <div class="mailbox-attachment-info">
          <div class="mailbox-attachment-name">
              <i class="fa fa-paperclip"></i> {$name}
              </div>
              <span class="mailbox-attachment-size">
                {$size}&nbsp;
                <a href="{$url}" class="btn btn-default btn-xs pull-right" target="_blank"><i class="fa fa-cloud-download"></i></a>
              </span>
        </div>
      </li>
    </ul>
  HTML ; } ) ; }
docstring: Show field as a file.
  
  @param string $server
  @param bool   $download
  
  @return Field
docstring_tokens: Show field as a file .