If you ever wonder or came across a situation where you need to get the table’s columns from the database without even calling the model.
This is the way how you can easily get them.
use Illuminate\Support\Facades\DB;
use App\Models\User;
$columns = DB::getSchemaBuilder()->getColumnListing('users');
// or you can use model to get columns
DB::getSchemaBuilder()->getColumnListing((new User())->getTable());