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?
following is my code in controller method
if($request->method=="edit")
{
/*we are in edit mode details of given news ID should be attached*/
$curNews=News::find($request->newsID);
if($curNews==null)return back()->withErrors(["Unable to Edit News:No Data Found For Given News ID"]);
foreach((array)$curNews->attributes as $key=>$val)
{
$data[$key]=$val;
}
}
return view('adminarea.news.news-addedit',$data);