Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //documento
- Schema::create('documento', function (Blueprint $table) {
- $table->increments('id');
- $table->integer('numero')->unsigned();
- $table->integer('tipo_documento_id')->unsigned();
- $table->integer('proveedor_id')->unsigned();
- $table->integer('user_id')->unsigned();
- $table->string('forma_pago');
- $table->integer('neto')->unsigned();
- $table->float('iva', 8, 2);
- $table->float('total');
- $table->timestamps();
- $table->foreign('tipo_documento_id')
- ->references('id')->on('tipo_documento')->onDelete('cascade');
- $table->foreign('proveedor_id')
- ->references('id')->on('proveedor')->onDelete('cascade');
- $table->foreign('user_id')
- ->references('id')->on('users')->onDelete('cascade');
- });
- //producto
- Schema::create('producto', function (Blueprint $table) {
- $table->increments('id');
- $table->string('nombre');
- $table->float('precio');
- $table->timestamps();
- });
- //Detalle Documento
- Schema::create('detalle_documento', function (Blueprint $table) {
- $table->increments('id');
- $table->integer('documento_id');
- $table->integer('producto_id');
- $table->integer('cantidad')->unsigned();
- $table->float('precio');
- $table->timestamps();
- $table->foreign('documento_id')->references('id')->on('documento')->onDelete('cascade');
- $table->foreign('producto_id')->references('id')->on('producto')->onDelete('cascade');
- });
- Schema::create('categoria', function (Blueprint $table) {
- $table->increments('id');
- $table->string('nombre');
- $table->timestamps();
- });
- Schema::create('producto_categoria', function (Blueprint $table) {
- $table->integer('producto_id');
- $table->integer('categoria_id');
- $table->foreign('producto_id')
- ->references('id')->on('producto')->onDelete('cascade');
- $table->foreign('categoria_id')
- ->references('id')->on('categoria')->onDelete('cascade');
- });
- //Proveedor
- Schema::create('proveedor', function (Blueprint $table) {
- $table->increments('id');
- $table->string('nombre');
- $table->string('rut', 100)->unique();
- $table->string('direccion');
- $table->string('email');
- $table->integer('telefono');
- $table->string('giro');
- $table->timestamps();
- });
Add Comment
Please, Sign In to add comment