Skip to content

Instantly share code, notes, and snippets.

@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');
@isimmons
isimmons / gist:7963369
Created December 14, 2013 18:58
Laravel 4.1 Full change list from 'php artisan changes' as of Dec 14, 2003
-> Added new hasManyThrough relationship type.
-> Cloned Eloquent query builders now clone the underlying query builder.
-> Allow for passing of custom attributes into Validator::make as fourth parameter.
-> Allow comma delimited list of queues to be passed to queue:listen / queue:work to implement queue priority.
-> When new bindings are added to container, old aliases bound to that key will now be dropped.