Laravel - Schema Builder Template

public function up() { Schema::create('clients', function (Blueprint $table) { $table->engine = 'InnoDB'; $table->increments('client_id'); /*Setup Foreign Key - Start*/ $table->integer('user_id')->unsigned(); $table->foreign('user_id')->references('id')->on('users'); /*Setup Foreign Key - End*/ /*Setup Foreign Key - Start*/ $table->integer('branch_id')->unsigned(); $table->foreign('branch_id')->references('branch_id')->on('branches'); /*Setup Foreign Key - End*/ $table->string('notes',1000)->nullable(true); $table->string('size',50)->nullable(false); $table->string('registered_company_name', 150)->nullable(); $table->dateTime('date_created'); $table->integer('status'); }); } public function down() { Schema::dropIfExists('clients'); }
- Reference snippet for Schema builder in laravel.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.