Skip to content

Instantly share code, notes, and snippets.

View yunusemremert's full-sized avatar
🐌
Just do it!

Yunus Emre MERT yunusemremert

🐌
Just do it!
View GitHub Profile
@isimmons
isimmons / gist:8202227
Last active March 15, 2024 10:47
Truncate tables with foreign key constraints in a Laravel seed file.

For the scenario, imagine posts has a foreign key user_id referencing users.id

public function up()
{
	Schema::create('posts', function(Blueprint $table) {
		$table->increments('id');
		$table->string('title');
		$table->text('body');