title: laravel:how to get columns name of eloquent model?
body: <p>I am using laravel 5.2 ,i want to get all the column (attribute) name of selected eloquent model,is there way to do this?</p>
  
  <p>following is my code in controller method</p>
  
  <pre><code>    if($request-&gt;method=="edit")
      {
          /*we are in edit mode details of given news ID should be attached*/
          $curNews=News::find($request-&gt;newsID);
          if($curNews==null)return back()-&gt;withErrors(["Unable to Edit News:No Data Found For Given News ID"]);
  
          foreach((array)$curNews-&gt;attributes as $key=&gt;$val)
          {
              $data[$key]=$val;
          }
  
      }
  
      return view('adminarea.news.news-addedit',$data);
  </code></pre>