0

I need to Show column names of a model in Laravel Eloquent. I need a array to use like:

if(in_array($colum, $columns))
Jorge
  • 41
  • 5

1 Answers1

1

Maybe you can use:

use Schema;
$accept_columns = Schema::getColumnListing('users');

 if(in_array($orderBy, $accept_columns))
{
   //Your code goes here
}
DEV Tiago França
  • 1,271
  • 9
  • 9