diff --git a/app/Http/Controllers/AromaController.php b/app/Http/Controllers/AromaController.php new file mode 100644 index 0000000..ecfcad6 --- /dev/null +++ b/app/Http/Controllers/AromaController.php @@ -0,0 +1,10 @@ +all()); + } + + + public function update() + { + + } + + + public function destroy() + { + + } +} diff --git a/app/Http/Controllers/CompraController.php b/app/Http/Controllers/CompraController.php new file mode 100644 index 0000000..4674d66 --- /dev/null +++ b/app/Http/Controllers/CompraController.php @@ -0,0 +1,10 @@ +hasMany(CompraDetalle::class); + } + public function aromaVenta(): HasMany + { + return $this->hasMany(VentaDetalle::class); + } +} diff --git a/app/Models/Caja.php b/app/Models/Caja.php new file mode 100644 index 0000000..e2a8db7 --- /dev/null +++ b/app/Models/Caja.php @@ -0,0 +1,31 @@ +hasMany(Compra::class); + } + public function cajaDebe(): HasMany + { + return $this->hasMany(Venta::class); + } + + public function usuarioCaja(): BelongsTo{ + return $this->belongsTo(User::class); + } +} diff --git a/app/Models/Cliente.php b/app/Models/Cliente.php new file mode 100644 index 0000000..9b85d5a --- /dev/null +++ b/app/Models/Cliente.php @@ -0,0 +1,23 @@ +hasMany(VentaDetalle::class); + } +} diff --git a/app/Models/Compra.php b/app/Models/Compra.php new file mode 100644 index 0000000..965ddac --- /dev/null +++ b/app/Models/Compra.php @@ -0,0 +1,27 @@ +hasMany(CompraDetalle::class); + } + + public function usuario(): HasMany // + { + return $this->hasMany(CompraDetalle::class); + } + + public function caja(): BelongsTo + { + return $this->belongsTo(Caja::class); + } +} diff --git a/app/Models/CompraDetalle.php b/app/Models/CompraDetalle.php new file mode 100644 index 0000000..199817f --- /dev/null +++ b/app/Models/CompraDetalle.php @@ -0,0 +1,35 @@ +belongsTo(Compra::class); + } + + public function caja(): BelongsTo + { + return $this->belongsTo(Caja::class); + } + public function productoCompraDetalle(): BelongsTo // + { + return $this->belongsTo(Producto::class); + } + + public function proveedorCompraDetalle(): BelongsTo // + { + return $this->belongsTo(Proveedor::class); + } + + public function aromaCompraDetalle(): BelongsTo // + { + return $this->belongsTo(Aroma::class); + } +} diff --git a/app/Models/CondicionVenta.php b/app/Models/CondicionVenta.php new file mode 100644 index 0000000..d70d22d --- /dev/null +++ b/app/Models/CondicionVenta.php @@ -0,0 +1,15 @@ +hasMany(Producto::class); + } +} diff --git a/app/Models/Marca.php b/app/Models/Marca.php new file mode 100644 index 0000000..8d9edaf --- /dev/null +++ b/app/Models/Marca.php @@ -0,0 +1,16 @@ +hasMany(Producto::class); + } +} diff --git a/app/Models/MetodoPago.php b/app/Models/MetodoPago.php new file mode 100644 index 0000000..76d269c --- /dev/null +++ b/app/Models/MetodoPago.php @@ -0,0 +1,16 @@ +hasMany(VentaPago::class); + } +} diff --git a/app/Models/Producto.php b/app/Models/Producto.php new file mode 100644 index 0000000..9c3502b --- /dev/null +++ b/app/Models/Producto.php @@ -0,0 +1,29 @@ +hasMany(CompraDetalle::class); + } + public function productoVenta(): HasMany + { + return $this->hasMany(VentaDetalle::class); + } + public function condicion(): BelongsTo + { + return $this->belongsTo(CondicionVenta::class); + } + public function marca(): BelongsTo + { + return $this->belongsTo(Marca::class); + } +} diff --git a/app/Models/Proveedor.php b/app/Models/Proveedor.php new file mode 100644 index 0000000..001fd60 --- /dev/null +++ b/app/Models/Proveedor.php @@ -0,0 +1,21 @@ +hasMany(CompraDetalle::class); + } + + public function proveedorVenta(): HasMany + { + return $this->hasMany(VentaDetalle::class); + } +} diff --git a/app/Models/Tienda.php b/app/Models/Tienda.php new file mode 100644 index 0000000..4048d3b --- /dev/null +++ b/app/Models/Tienda.php @@ -0,0 +1,11 @@ + - */ - protected $fillable = [ - 'name', - 'email', - 'password', - ]; + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ + 'name', + 'email', + 'password', + ]; - /** - * The attributes that should be hidden for serialization. - * - * @var array - */ - protected $hidden = [ - 'password', - 'remember_token', - ]; + /** + * The attributes that should be hidden for serialization. + * + * @var array + */ + protected $hidden = [ + 'password', + 'remember_token', + ]; - /** - * The attributes that should be cast. - * - * @var array - */ - protected $casts = [ - 'email_verified_at' => 'datetime', - 'password' => 'hashed', - ]; + /** + * The attributes that should be cast. + * + * @var array + */ + protected $casts = [ + 'email_verified_at' => 'datetime', + ]; + + public function usuarioCompra(): HasMany // + { + return $this->hasMany(Compra::class); + } + public function usuarioVenta(): HasMany // + { + return $this->hasMany(Venta::class); + } + public function usuarioCaja(): HasMany // + { + return $this->hasMany(Caja::class); + } } diff --git a/app/Models/Venta.php b/app/Models/Venta.php new file mode 100644 index 0000000..40068d8 --- /dev/null +++ b/app/Models/Venta.php @@ -0,0 +1,24 @@ +hasMany(VentaDetalle::class); + } + public function usuario(): HasMany + { + return $this->hasMany(User::class); + } + public function caja(): HasMany + { + return $this->hasMany(Caja::class); + } +} diff --git a/app/Models/VentaDetalle.php b/app/Models/VentaDetalle.php new file mode 100644 index 0000000..ceb408a --- /dev/null +++ b/app/Models/VentaDetalle.php @@ -0,0 +1,40 @@ +belongsTo(Venta::class); + } + + public function caja(): BelongsTo + { + return $this->belongsTo(Caja::class); + } + + public function clienteVenta(): BelongsTo // + { + return $this->belongsTo(Cliente::class); + } + public function productoVentaDetalle(): BelongsTo // + { + return $this->belongsTo(Producto::class); + } + + public function proveedorVentaDetalle(): BelongsTo // + { + return $this->belongsTo(Proveedor::class); + } + + public function aromaVentaDetalle(): BelongsTo // + { + return $this->belongsTo(Aroma::class); + } +} diff --git a/app/Models/VentaPago.php b/app/Models/VentaPago.php new file mode 100644 index 0000000..1681b6a --- /dev/null +++ b/app/Models/VentaPago.php @@ -0,0 +1,16 @@ +belongsTo(MetodoPago::class); + } +} diff --git a/cosas.txt b/cosas.txt new file mode 100644 index 0000000..bce13bc --- /dev/null +++ b/cosas.txt @@ -0,0 +1,23 @@ +-----Vistas------ +Dashboard +----------------- +CRUD +-Crud producto +-Crud marcas +-Crud proveeores +-Crud aromas +-Crud cliente +----------------- +Secciones +-Caja +-Perfil de usuario +-Perfil de tienda +-Entradas +-Salidas/Facturacion +-Stock +----------------- +Informes +-Venta +-Compra +-Venta por producto +-Venta por marca \ No newline at end of file diff --git a/database/factories/ProductFactory.php b/database/factories/ProductFactory.php new file mode 100644 index 0000000..c5a973e --- /dev/null +++ b/database/factories/ProductFactory.php @@ -0,0 +1,27 @@ + + */ +class ProductFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + 'code' => fake()->randomNumber(4,false), + 'name' => fake()->name(), + 'quantity' => fake()->randomNumber(2,false), + 'price' => fake()->randomFloat(2,5,5), + 'description' => fake()->text(50), + ]; + } +} diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 444fafb..c7aebd8 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -4,29 +4,30 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ - /** - * Run the migrations. - */ - public function up(): void - { - Schema::create('users', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->string('email')->unique(); - $table->timestamp('email_verified_at')->nullable(); - $table->string('password'); - $table->rememberToken(); - $table->timestamps(); - }); - } +return new class extends Migration { + /** + * Run the migrations. + */ + public function up(): void + { + Schema::create('users', function (Blueprint $table) { + $table->id(); + $table->string('username'); + $table->string('password'); + $table->string('telefono'); + $table->string('rol'); + $table->string('email')->unique(); + $table->timestamp('email_verified_at')->nullable(); + $table->rememberToken(); + $table->timestamps(); + }); + } - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('users'); - } + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('users'); + } }; diff --git a/database/migrations/2024_05_21_122513_create_compras_table.php b/database/migrations/2024_05_21_122513_create_compras_table.php new file mode 100644 index 0000000..43a5228 --- /dev/null +++ b/database/migrations/2024_05_21_122513_create_compras_table.php @@ -0,0 +1,29 @@ +id(); + $table->integer('usuario_id'); + $table->integer('caja_id'); + $table->double('total'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('compras'); + } +}; diff --git a/database/migrations/2024_05_21_122620_create_ventas_table.php b/database/migrations/2024_05_21_122620_create_ventas_table.php new file mode 100644 index 0000000..3ebb411 --- /dev/null +++ b/database/migrations/2024_05_21_122620_create_ventas_table.php @@ -0,0 +1,29 @@ +id(); + $table->integer('usuario_id'); + $table->integer('caja_id'); + $table->double('total'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('ventas'); + } +}; diff --git a/database/migrations/2024_05_21_122712_create_metodo_pagos_table.php b/database/migrations/2024_05_21_122712_create_metodo_pagos_table.php new file mode 100644 index 0000000..3b2cf68 --- /dev/null +++ b/database/migrations/2024_05_21_122712_create_metodo_pagos_table.php @@ -0,0 +1,27 @@ +id(); + $table->string('nombre'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('metodo_pagos'); + } +}; diff --git a/database/migrations/2024_05_21_123703_create_compra_detalles_table.php b/database/migrations/2024_05_21_123703_create_compra_detalles_table.php new file mode 100644 index 0000000..6ce4a9f --- /dev/null +++ b/database/migrations/2024_05_21_123703_create_compra_detalles_table.php @@ -0,0 +1,32 @@ +id(); + $table->integer('compra_id'); + $table->integer('producto_id'); + $table->integer('proveedor_id'); + $table->integer('aroma_id'); + $table->double('precio_costo'); + $table->integer('cantidad'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('compra_detalles'); + } +}; diff --git a/database/migrations/2024_05_21_123722_create_venta_detalles_table.php b/database/migrations/2024_05_21_123722_create_venta_detalles_table.php new file mode 100644 index 0000000..eda647d --- /dev/null +++ b/database/migrations/2024_05_21_123722_create_venta_detalles_table.php @@ -0,0 +1,33 @@ +id(); + $table->integer('venta_id'); + $table->integer('producto_id'); + $table->integer('proveedor_id'); + $table->integer('aroma_id'); + $table->integer('cliente_id'); + $table->double('precio_costo'); + $table->integer('cantidad'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('venta_detalles'); + } +}; diff --git a/database/migrations/2024_05_21_123740_create_venta_pagos_table.php b/database/migrations/2024_05_21_123740_create_venta_pagos_table.php new file mode 100644 index 0000000..68671ae --- /dev/null +++ b/database/migrations/2024_05_21_123740_create_venta_pagos_table.php @@ -0,0 +1,29 @@ +id(); + $table->integer('venta_id'); + $table->integer('metodo_pago_id'); + $table->double('monto'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('venta_pagos'); + } +}; diff --git a/database/migrations/2024_05_21_132437_create_marcas_table.php b/database/migrations/2024_05_21_132437_create_marcas_table.php new file mode 100644 index 0000000..cb30b5f --- /dev/null +++ b/database/migrations/2024_05_21_132437_create_marcas_table.php @@ -0,0 +1,28 @@ +id(); + $table->string('nombre'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('marcas'); + } +}; diff --git a/database/migrations/2024_05_21_132448_create_cajas_table.php b/database/migrations/2024_05_21_132448_create_cajas_table.php new file mode 100644 index 0000000..6d041ff --- /dev/null +++ b/database/migrations/2024_05_21_132448_create_cajas_table.php @@ -0,0 +1,30 @@ +id(); + $table->integer('usuario_id'); + $table->double('monto_inicial'); + $table->double('monto_final'); + $table->timestamps(); + $table->dateTime('fecha_cierre'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('cajas'); + } +}; diff --git a/database/migrations/2024_05_21_132459_create_clientes_table.php b/database/migrations/2024_05_21_132459_create_clientes_table.php new file mode 100644 index 0000000..574d2b4 --- /dev/null +++ b/database/migrations/2024_05_21_132459_create_clientes_table.php @@ -0,0 +1,32 @@ +id(); + $table->integer('dni'); + $table->string('nombre'); + $table->string('apellido'); + $table->string('telefono', 15); + $table->string('direccion_calle'); + $table->integer('direccion_numero'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('clientes'); + } +}; diff --git a/database/migrations/2024_05_21_132514_create_aromas_table.php b/database/migrations/2024_05_21_132514_create_aromas_table.php new file mode 100644 index 0000000..e97e2c2 --- /dev/null +++ b/database/migrations/2024_05_21_132514_create_aromas_table.php @@ -0,0 +1,27 @@ +id(); + $table->string('nombre'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('aromas'); + } +}; diff --git a/database/migrations/2024_05_21_132530_create_productos_table.php b/database/migrations/2024_05_21_132530_create_productos_table.php new file mode 100644 index 0000000..2ccaf67 --- /dev/null +++ b/database/migrations/2024_05_21_132530_create_productos_table.php @@ -0,0 +1,30 @@ +id(); + $table->integer('marca_id'); + $table->integer('condicion_venta_id'); + $table->string('nombre'); + $table->string('descripcion'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('productos'); + } +}; diff --git a/database/migrations/2024_05_21_132538_create_proveedores_table.php b/database/migrations/2024_05_21_132538_create_proveedores_table.php new file mode 100644 index 0000000..83ef017 --- /dev/null +++ b/database/migrations/2024_05_21_132538_create_proveedores_table.php @@ -0,0 +1,27 @@ +id(); + $table->string('nombre'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('proveedores'); + } +}; diff --git a/database/migrations/2024_05_21_132548_create_tiendas_table.php b/database/migrations/2024_05_21_132548_create_tiendas_table.php new file mode 100644 index 0000000..f3eca27 --- /dev/null +++ b/database/migrations/2024_05_21_132548_create_tiendas_table.php @@ -0,0 +1,33 @@ +id(); + $table->string('nombre'); + $table->string('telefono'); + $table->string('email'); + $table->string('direccion_calle'); + $table->integer('direccion_numero'); + $table->string('localidad'); + $table->string('departamento'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('tiendas'); + } +}; diff --git a/database/migrations/2024_05_21_133042_create_condicion_ventas_table.php b/database/migrations/2024_05_21_133042_create_condicion_ventas_table.php new file mode 100644 index 0000000..389b199 --- /dev/null +++ b/database/migrations/2024_05_21_133042_create_condicion_ventas_table.php @@ -0,0 +1,27 @@ +id(); + $table->string('condicion_id'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('condicion_ventas'); + } +}; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index a9f4519..c549eea 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -18,5 +18,7 @@ public function run(): void // 'name' => 'Test User', // 'email' => 'test@example.com', // ]); + + \App\Models\Product::factory(10)->create(); } } diff --git a/routes/web.php b/routes/web.php index 7d7927d..760ec50 100644 --- a/routes/web.php +++ b/routes/web.php @@ -17,4 +17,5 @@ Route::get('/', function () { return view('welcome'); }); -Route::resource('products', ProductController::class); \ No newline at end of file +Route::resource('products', ProductController::class); +ruta::altaruta('Funciona', Alta::clase); \ No newline at end of file