Guest User

Untitled

a guest
Feb 24th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. //documento
  2. Schema::create('documento', function (Blueprint $table) {
  3. $table->increments('id');
  4. $table->integer('numero')->unsigned();
  5. $table->integer('tipo_documento_id')->unsigned();
  6. $table->integer('proveedor_id')->unsigned();
  7. $table->integer('user_id')->unsigned();
  8. $table->string('forma_pago');
  9. $table->integer('neto')->unsigned();
  10. $table->float('iva', 8, 2);
  11. $table->float('total');
  12. $table->timestamps();
  13.  
  14. $table->foreign('tipo_documento_id')
  15. ->references('id')->on('tipo_documento')->onDelete('cascade');
  16. $table->foreign('proveedor_id')
  17. ->references('id')->on('proveedor')->onDelete('cascade');
  18. $table->foreign('user_id')
  19. ->references('id')->on('users')->onDelete('cascade');
  20. });
  21.  
  22. //producto
  23. Schema::create('producto', function (Blueprint $table) {
  24. $table->increments('id');
  25. $table->string('nombre');
  26. $table->float('precio');
  27. $table->timestamps();
  28. });
  29.  
  30. //Detalle Documento
  31.  
  32. Schema::create('detalle_documento', function (Blueprint $table) {
  33. $table->increments('id');
  34. $table->integer('documento_id');
  35. $table->integer('producto_id');
  36. $table->integer('cantidad')->unsigned();
  37. $table->float('precio');
  38. $table->timestamps();
  39.  
  40. $table->foreign('documento_id')->references('id')->on('documento')->onDelete('cascade');
  41. $table->foreign('producto_id')->references('id')->on('producto')->onDelete('cascade');
  42. });
  43.  
  44. Schema::create('categoria', function (Blueprint $table) {
  45. $table->increments('id');
  46. $table->string('nombre');
  47. $table->timestamps();
  48. });
  49.  
  50. Schema::create('producto_categoria', function (Blueprint $table) {
  51. $table->integer('producto_id');
  52. $table->integer('categoria_id');
  53.  
  54. $table->foreign('producto_id')
  55. ->references('id')->on('producto')->onDelete('cascade');
  56. $table->foreign('categoria_id')
  57. ->references('id')->on('categoria')->onDelete('cascade');
  58. });
  59.  
  60. //Proveedor
  61. Schema::create('proveedor', function (Blueprint $table) {
  62. $table->increments('id');
  63. $table->string('nombre');
  64. $table->string('rut', 100)->unique();
  65. $table->string('direccion');
  66. $table->string('email');
  67. $table->integer('telefono');
  68. $table->string('giro');
  69. $table->timestamps();
  70. });
Add Comment
Please, Sign In to add comment