laravel excel get headers and maatwebsite
<p>I want to get only my excel first column that will be column name.</p>

<p>I am using this code</p>

<pre><code>Excel::load($request-&gt;file, function ($reader) use($request) {

$torarray=$reader-&gt;toArray();
            $line0 = $torarray[0];
            $headers = array_keys($line0);
            $excel_header=$headers;
        });
</code></pre>

<p>Sometimes it works but some times not work. when not work with some files the i write below that and works</p>

<pre><code>$torarray=$reader-&gt;toArray();
            $line0 = $torarray[0][0];
            $headers = array_keys($line0);
            $excel_header=$headers;
        });
</code></pre>

<p>I cant understand whats the correct solution.</p>