Ajustando modelos

This commit is contained in:
2025-01-05 16:14:29 -03:00
parent fd5298b990
commit 6ec3344c17
21 changed files with 172 additions and 305 deletions

View File

@@ -15,10 +15,10 @@ namespace App\Models{
/** /**
* *
* *
* @property int $id * @property string $id
* @property int $valor * @property int $valor
* @property string $descripcion * @property string $descripcion
* @property int $turno_id * @property string $turno_id
* @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at * @property \Illuminate\Support\Carbon|null $updated_at
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalculoFondo newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder<static>|CalculoFondo newModelQuery()
@@ -38,7 +38,7 @@ namespace App\Models{
/** /**
* *
* *
* @property int $id * @property string $id
* @property int $veinte_mil * @property int $veinte_mil
* @property int $diez_mil * @property int $diez_mil
* @property int $cinco_mil * @property int $cinco_mil
@@ -48,6 +48,7 @@ namespace App\Models{
* @property int $cien * @property int $cien
* @property int $cincuenta * @property int $cincuenta
* @property int $diez * @property int $diez
* @property string $turno_id
* @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at * @property \Illuminate\Support\Carbon|null $updated_at
* @method static \Illuminate\Database\Eloquent\Builder<static>|Efectivo newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder<static>|Efectivo newModelQuery()
@@ -63,6 +64,7 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder<static>|Efectivo whereId($value) * @method static \Illuminate\Database\Eloquent\Builder<static>|Efectivo whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Efectivo whereMil($value) * @method static \Illuminate\Database\Eloquent\Builder<static>|Efectivo whereMil($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Efectivo whereQuinientos($value) * @method static \Illuminate\Database\Eloquent\Builder<static>|Efectivo whereQuinientos($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Efectivo whereTurnoId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Efectivo whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder<static>|Efectivo whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Efectivo whereVeinteMil($value) * @method static \Illuminate\Database\Eloquent\Builder<static>|Efectivo whereVeinteMil($value)
*/ */
@@ -73,12 +75,12 @@ namespace App\Models{
/** /**
* *
* *
* @property int $id * @property string $id
* @property string $numero * @property string $numero
* @property string $descripcion * @property string $descripcion
* @property int $valor * @property int $valor
* @property string $tipo_egreso * @property string $tipo_egreso
* @property int $turno_id * @property string $turno_id
* @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at * @property \Illuminate\Support\Carbon|null $updated_at
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egreso newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder<static>|Egreso newModelQuery()
@@ -100,7 +102,7 @@ namespace App\Models{
/** /**
* *
* *
* @property int $id * @property string $id
* @property string $mes * @property string $mes
* @property int $costo_venta * @property int $costo_venta
* @property int $cuenta_corriente_factura * @property int $cuenta_corriente_factura
@@ -159,14 +161,14 @@ namespace App\Models{
/** /**
* *
* *
* @property int $id * @property string $id
* @property int $numero * @property int $numero
* @property int $numero_z * @property int $numero_z
* @property int $ingreso_inicial * @property int $ingreso_inicial
* @property int $ingreso_final * @property int $ingreso_final
* @property int $total * @property int $total
* @property string $tipo_ingreso * @property string $tipo_ingreso
* @property int $turno_id * @property string $turno_id
* @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at * @property \Illuminate\Support\Carbon|null $updated_at
* @method static \Illuminate\Database\Eloquent\Builder<static>|Ingreso newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder<static>|Ingreso newModelQuery()
@@ -190,7 +192,7 @@ namespace App\Models{
/** /**
* *
* *
* @property int $id * @property string $id
* @property string $fecha * @property string $fecha
* @property int $numero_caja * @property int $numero_caja
* @property int $numero_turno * @property int $numero_turno
@@ -215,7 +217,7 @@ namespace App\Models{
/** /**
* *
* *
* @property int $id * @property string $id
* @property string $name * @property string $name
* @property string $email * @property string $email
* @property \Illuminate\Support\Carbon|null $email_verified_at * @property \Illuminate\Support\Carbon|null $email_verified_at

View File

@@ -2,9 +2,12 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Concerns\HasUlids;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class CalculoFondo extends Model class CalculoFondo extends Model
{ {
use HasUlids;
protected $table = 'calculo_fondos'; protected $table = 'calculo_fondos';
} }

View File

@@ -2,9 +2,12 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Concerns\HasUlids;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Documentos extends Model class Documentos extends Model
{ {
use HasUlids;
protected $table = 'documentos'; protected $table = 'documentos';
} }

View File

@@ -2,9 +2,12 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Concerns\HasUlids;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Efectivo extends Model class Efectivo extends Model
{ {
use HasUlids;
protected $table = 'efectivos'; protected $table = 'efectivos';
} }

View File

@@ -2,9 +2,12 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Concerns\HasUlids;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Egreso extends Model class Egreso extends Model
{ {
use HasUlids;
protected $table = 'egresos'; protected $table = 'egresos';
} }

View File

@@ -2,9 +2,12 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Concerns\HasUlids;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class EstadoResultado extends Model class EstadoResultado extends Model
{ {
use HasUlids;
protected $table = 'estados_resultado'; protected $table = 'estados_resultado';
} }

View File

@@ -2,9 +2,12 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Concerns\HasUlids;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class GastosCuentaCorriente extends Model class GastosCuentaCorriente extends Model
{ {
use HasUlids;
protected $table = 'gastos_cuenta_corriente'; protected $table = 'gastos_cuenta_corriente';
} }

View File

@@ -2,9 +2,12 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Concerns\HasUlids;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Ingreso extends Model class Ingreso extends Model
{ {
use HasUlids;
protected $table = 'ingresos'; protected $table = 'ingresos';
} }

View File

@@ -2,9 +2,12 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Concerns\HasUlids;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Turno extends Model class Turno extends Model
{ {
use HasUlids;
protected $table = 'turnos'; protected $table = 'turnos';
} }

View File

@@ -2,42 +2,28 @@
namespace App\Models; namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Concerns\HasUlids;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
class User extends Authenticatable class User extends Authenticatable
{ {
/** @use HasFactory<\Database\Factories\UserFactory> */ use HasFactory, Notifiable, HasUlids;
use HasFactory, Notifiable;
protected $table = 'users';
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [ protected $fillable = [
'name', 'name',
'email', 'email',
'password', 'password',
]; ];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [ protected $hidden = [
'password', 'password',
'remember_token', 'remember_token',
]; ];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array protected function casts(): array
{ {
return [ return [

View File

@@ -2,7 +2,6 @@
namespace App\Providers; namespace App\Providers;
use App\Models\CalculoFondo;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
@@ -21,6 +20,8 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function boot(): void public function boot(): void
{ {
Model::preventLazyLoading(! app()->isProduction()); $isProduction = app()->isProduction();
Model::shouldBeStrict(! $isProduction);
} }
} }

View File

@@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::create('users', function (Blueprint $table) { Schema::create('users', function (Blueprint $table) {
$table->id(); $table->ulid('id')->primary();
$table->string('name'); $table->string('name');
$table->string('email')->unique(); $table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable(); $table->timestamp('email_verified_at')->nullable();
@@ -29,7 +29,7 @@ return new class extends Migration
Schema::create('sessions', function (Blueprint $table) { Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary(); $table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index(); $table->foreignUlid('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable(); $table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable(); $table->text('user_agent')->nullable();
$table->longText('payload'); $table->longText('payload');

View File

@@ -0,0 +1,127 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('turnos', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->date('fecha');
$table->integer('numero_caja');
$table->integer('numero_turno');
$table->integer('fondo');
$table->timestamps();
});
Schema::create('calculo_fondos', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->bigInteger('valor');
$table->text('descripcion');
$table->foreignUlid('turno_id')->constrained('turnos')->cascadeOnDelete();
$table->timestamps();
});
Schema::create('documentos', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->text('descripcion');
$table->bigInteger('valor');
$table->text('tipo_documento');
$table->foreignUlid('turno_id')->constrained('turnos')->cascadeOnDelete();
$table->timestamps();
});
Schema::create('efectivos', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->bigInteger('veinte_mil')->default(0);
$table->bigInteger('diez_mil')->default(0);
$table->bigInteger('cinco_mil')->default(0);
$table->bigInteger('dos_mil')->default(0);
$table->bigInteger('mil')->default(0);
$table->bigInteger('quinientos')->default(0);
$table->bigInteger('cien')->default(0);
$table->bigInteger('cincuenta')->default(0);
$table->bigInteger('diez')->default(0);
$table->foreignUlid('turno_id')->constrained('turnos')->cascadeOnDelete();
$table->timestamps();
});
Schema::create('egresos', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->text('numero');
$table->text('descripcion');
$table->bigInteger('valor');
$table->text('tipo_egreso');
$table->foreignUlid('turno_id')->constrained('turnos')->cascadeOnDelete();
$table->timestamps();
});
Schema::create('estados_resultado', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->date('mes');
$table->bigInteger('costo_venta');
$table->bigInteger('cuenta_corriente_factura');
$table->bigInteger('cuenta_corriente_boleta');
$table->bigInteger('cuenta_corriente_sin_respaldo');
$table->bigInteger('cuenta_corriente_partime');
$table->bigInteger('remuneraciones');
$table->bigInteger('finiquitos');
$table->bigInteger('aguinaldo');
$table->bigInteger('bonos_personal');
$table->bigInteger('honorarios_contador');
$table->bigInteger('arriendo');
$table->bigInteger('agua');
$table->bigInteger('luz');
$table->bigInteger('gas');
$table->bigInteger('telefono');
$table->bigInteger('otro_servicio');
$table->decimal('ppm', 15, 2);
$table->bigInteger('iva_a_favor');
$table->bigInteger('dias_habiles');
$table->bigInteger('dias_trabajados');
$table->timestamps();
});
Schema::create('gastos_cuenta_corriente', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->bigInteger('valor');
$table->text('descripcion');
$table->text('tipo_gasto');
$table->foreignUlid('estado_resultado_id')->constrained('estados_resultado')->cascadeOnDelete();
$table->timestamps();
});
Schema::create('ingresos', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->bigInteger('numero');
$table->bigInteger('numero_z');
$table->bigInteger('ingreso_inicial');
$table->bigInteger('ingreso_final');
$table->bigInteger('total');
$table->text('tipo_ingreso');
$table->foreignUlid('turno_id')->constrained('turnos')->cascadeOnDelete();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ingresos');
Schema::dropIfExists('gastos_cuenta_corriente');
Schema::dropIfExists('estados_resultado');
Schema::dropIfExists('egresos');
Schema::dropIfExists('efectivos');
Schema::dropIfExists('documentos');
Schema::dropIfExists('calculo_fondos');
Schema::dropIfExists('turnos');
}
};

View File

@@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('turnos', function (Blueprint $table) {
$table->id();
$table->date('fecha');
$table->integer('numero_caja');
$table->integer('numero_turno');
$table->integer('fondo');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('turnos');
}
};

View File

@@ -1,30 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('calculo_fondos', function (Blueprint $table) {
$table->id();
$table->bigInteger('valor');
$table->text('descripcion');
$table->foreignId('turno_id')->constrained('turnos')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('calculo_fondos');
}
};

View File

@@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('documentos', function (Blueprint $table) {
$table->id();
$table->text('descripcion');
$table->bigInteger('valor');
$table->text('tipo_documento');
$table->foreignId('turno_id')->constrained('turnos')->cascadeOnDelete();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('documentos');
}
};

View File

@@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('efectivos', function (Blueprint $table) {
$table->id();
$table->bigInteger('veinte_mil')->default(0);
$table->bigInteger('diez_mil')->default(0);
$table->bigInteger('cinco_mil')->default(0);
$table->bigInteger('dos_mil')->default(0);
$table->bigInteger('mil')->default(0);
$table->bigInteger('quinientos')->default(0);
$table->bigInteger('cien')->default(0);
$table->bigInteger('cincuenta')->default(0);
$table->bigInteger('diez')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('efectivos');
}
};

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('egresos', function (Blueprint $table) {
$table->id();
$table->text('numero');
$table->text('descripcion');
$table->bigInteger('valor');
$table->text('tipo_egreso');
$table->foreignId('turno_id')->constrained('turnos')->cascadeOnDelete();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('egresos');
}
};

View File

@@ -1,48 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('estados_resultado', function (Blueprint $table) {
$table->id();
$table->date('mes');
$table->bigInteger('costo_venta');
$table->bigInteger('cuenta_corriente_factura');
$table->bigInteger('cuenta_corriente_boleta');
$table->bigInteger('cuenta_corriente_sin_respaldo');
$table->bigInteger('cuenta_corriente_partime');
$table->bigInteger('remuneraciones');
$table->bigInteger('finiquitos');
$table->bigInteger('aguinaldo');
$table->bigInteger('bonos_personal');
$table->bigInteger('honorarios_contador');
$table->bigInteger('arriendo');
$table->bigInteger('agua');
$table->bigInteger('luz');
$table->bigInteger('gas');
$table->bigInteger('telefono');
$table->bigInteger('otro_servicio');
$table->decimal('ppm', 15, 2);
$table->bigInteger('iva_a_favor');
$table->bigInteger('dias_habiles');
$table->bigInteger('dias_trabajados');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('estados_resultado');
}
};

View File

@@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('gastos_cuenta_corriente', function (Blueprint $table) {
$table->id();
$table->bigInteger('valor');
$table->text('descripcion');
$table->text('tipo_gasto');
$table->foreignId('estado_resultado_id')->constrained('estados_resultado')->cascadeOnDelete();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('gastos_cuenta_corriente');
}
};

View File

@@ -1,34 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('ingresos', function (Blueprint $table) {
$table->id();
$table->bigInteger('numero');
$table->bigInteger('numero_z');
$table->bigInteger('ingreso_inicial');
$table->bigInteger('ingreso_final');
$table->bigInteger('total');
$table->text('tipo_ingreso');
$table->foreignId('turno_id')->constrained('turnos')->cascadeOnDelete();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ingresos');
}
};