title: Yii2 GridView hide column conditionally
body: <p>I am displaying some columns in Yii2 GridView widget, 'Executive Name' is one of those but it should be displayed only when a Supervisor is logged in not when Executive logged in.</p>
  
  <p>When I am hard coding visible to zero it is not displaying as follows:</p>
  
  <pre><code>[
      'label' =&gt; 'Executive Name',
      'attribute' =&gt; 'cs.first_name',
      'visible' =&gt; '0',
  ],
  </code></pre>
  
  <p>But I want to display it conditionally something like this:</p>
  
  <pre><code>[
      'label' =&gt; 'Executive Name',
      'attribute' =&gt; 'cs.first_name',
      'visible' =&gt; function ($data) {
          if ($data-&gt;hc_customersupport-&gt;is_supervisor) {
              return '1'; // or return true;
          } else {
              return '0'; // or return false;
          }
      },
  ],
  </code></pre>
  
  <p>Please tell if this approach is correct.</p>