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 string $descripcion
* @property int $turno_id
* @property string $turno_id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @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 $diez_mil
* @property int $cinco_mil
@@ -48,6 +48,7 @@ namespace App\Models{
* @property int $cien
* @property int $cincuenta
* @property int $diez
* @property string $turno_id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @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 whereMil($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 whereVeinteMil($value)
*/
@@ -73,12 +75,12 @@ namespace App\Models{
/**
*
*
* @property int $id
* @property string $id
* @property string $numero
* @property string $descripcion
* @property int $valor
* @property string $tipo_egreso
* @property int $turno_id
* @property string $turno_id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @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 int $costo_venta
* @property int $cuenta_corriente_factura
@@ -159,14 +161,14 @@ namespace App\Models{
/**
*
*
* @property int $id
* @property string $id
* @property int $numero
* @property int $numero_z
* @property int $ingreso_inicial
* @property int $ingreso_final
* @property int $total
* @property string $tipo_ingreso
* @property int $turno_id
* @property string $turno_id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @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 int $numero_caja
* @property int $numero_turno
@@ -215,7 +217,7 @@ namespace App\Models{
/**
*
*
* @property int $id
* @property string $id
* @property string $name
* @property string $email
* @property \Illuminate\Support\Carbon|null $email_verified_at

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -2,7 +2,6 @@
namespace App\Providers;
use App\Models\CalculoFondo;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\ServiceProvider;
@@ -21,6 +20,8 @@ class AppServiceProvider extends ServiceProvider
*/
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
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->ulid('id')->primary();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
@@ -29,7 +29,7 @@ return new class extends Migration
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->foreignUlid('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$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');
}
};