Created
January 15, 2024 02:50
-
-
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 ...)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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