Skip to content

Instantly share code, notes, and snippets.

View NiltonMorais's full-sized avatar

Nilton Morais NiltonMorais

View GitHub Profile
@NiltonMorais
NiltonMorais / gist:d50b955b8b79d5834a07fc29a309c66a
Created August 2, 2016 17:56 — forked from isimmons/gist:8202227
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');
@NiltonMorais
NiltonMorais / autoload.php
Created June 9, 2016 15:50
Autoload Example
<?php
define('CLASS_DIR', __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR);
set_include_path(get_include_path().PATH_SEPARATOR.CLASS_DIR);
spl_autoload_register();