Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.04 KB | None | 0 0
  1. <?php
  2.  
  3. use Illuminate\Support\Facades\Schema;
  4. use Illuminate\Database\Schema\Blueprint;
  5. use Illuminate\Database\Migrations\Migration;
  6.  
  7. class CreateBeliCashTable extends Migration
  8. {
  9.     /**
  10.      * Run the migrations.
  11.      *
  12.      * @return void
  13.      */
  14.     public function up()
  15.     {
  16.         Schema::create('beli_cash', function(Blueprint $table){
  17.           $table->string('kode_cash')->primary();
  18.           $table->string('ktp');
  19.           $table->string('kode_mobil');
  20.           $table->string('cash_tgl');
  21.           $table->string('cash_bayar');
  22.           $table->timestamps();
  23.  
  24.  
  25.           $table->foreign('ktp')
  26.                 ->references('ktp')
  27.                 ->on('pembeli')
  28.                 ->onUpdate('cascade')
  29.                 ->onDelete('cascade');
  30.  
  31.           $table->foreign('kode_mobil')
  32.                 ->references('kode_mobil')
  33.                 ->on('mobil')
  34.                 ->onUpdate('cascade')
  35.                 ->onDelete('cascade');
  36.         });
  37.     }
  38.  
  39.     /**
  40.      * Reverse the migrations.
  41.      *
  42.      * @return void
  43.      */
  44.     public function down()
  45.     {
  46.         Schema::drop('beli_cash');
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement