Skip to content

Instantly share code, notes, and snippets.

@horaciod
Created January 15, 2024 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save horaciod/b5e5d1e8188bdc7e6e7b2e247c911c98 to your computer and use it in GitHub Desktop.
Save horaciod/b5e5d1e8188bdc7e6e7b2e247c911c98 to your computer and use it in GitHub Desktop.
laravel to get all the fields in a table as array (for $fillable ...)
<?php
$x = collect(Schema::getColumnListing('templatefields'))
->transform(function ($item, $key) {
return "
'" . $item ."'"
;
})
->implode(",");
;
echo "[". $x.']';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment