https://github.com/io-digital/truncate-tables
A Laravel package to easily truncate database tables when running seeder files
https://github.com/io-digital/truncate-tables
database laravel php seeder truncate
Last synced: 3 months ago
JSON representation
A Laravel package to easily truncate database tables when running seeder files
- Host: GitHub
- URL: https://github.com/io-digital/truncate-tables
- Owner: io-digital
- License: mit
- Created: 2021-05-02T01:59:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-05-02T13:20:38.000Z (over 4 years ago)
- Last Synced: 2025-06-26T09:50:19.115Z (3 months ago)
- Topics: database, laravel, php, seeder, truncate
- Language: PHP
- Homepage:
- Size: 248 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# A Laravel package to easily truncate database tables when running seeder files
[](https://packagist.org/packages/io-digital/truncate-tables)
[](https://github.com/io-digital/truncate-tables/actions?query=workflow%3Arun-tests+branch%3Amaster)
[](https://github.com/io-digital/truncate-tables/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amaster)
[](https://packagist.org/packages/io-digital/truncate-tables)## Installation
You can install the package via composer:
```bash
composer require io-digital/truncate-tables
```## Usage
In `database/seeders/DatabaseSeeder.php`:
```php
clean();
// Or like the following
TruncateTable::fromArrays([
'users',
'posts'
], [
UserTableSeeder::class,
PostTableSeeder::class,
])->cleanAndSeed();
}
}
```## Testing
```bash
composer test
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
## Credits
- [Gareth Nicholson](https://github.com/io-digital)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.