<?php array_splice( array &$array, int $offset, ?int $length = null, mixed $replacement = []): array
<?php $line = $import->getStartLine(); } array_splice($lines, $line - 1, 0, 'use Illuminate\\Database\\Eloquent\\Factories\\HasFactory;'); $traits = $class->getTraitUses(); if (empty($traits)) {
<?php ++$line; // advance one more line to place the trait... } array_splice($lines, $line, 0, ' use HasFactory;' . PHP_EOL); } else { $line = $traits[0]->getStartLine(); array_splice($lines, $line + 1, 0, ' use HasFactory;');
<?php array_splice($lines, $line, 0, ' use HasFactory;' . PHP_EOL); } else { $line = $traits[0]->getStartLine(); array_splice($lines, $line + 1, 0, ' use HasFactory;'); } File::put($path, implode(PHP_EOL, $lines));