- Sistema de propiedades: tabla, modelo, CRUD API para que el cliente guarde direcciones nombradas - Postulacion renovada: cliente elige propiedad sin precio ni fecha, sube fotos a GCS/S3 - Proveedores ofertan date_1, date_2 y amount al postularse via pivot; sort por fecha/monto/membresia - Contratacion: selected_date recibe date_1 o date_2, amount desde pivot (depreca minimun_fee) - Cancelacion/repostulacion: archive con status=perdido, related_postulation_id para vincular - Chat en contratos activos: tabla contract_comments, controller, rutas web+API, vista panel, notificaciones bilingues - PaymentIntent calcula amount desde pivot en vez de recibirlo del front - getpendingcontracts: sin filtro de tiempo, filtra por status=active, agrega time_created - Expiracion de postulaciones reducida a 1000 min Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
77 lines
1.5 KiB
PHP
Executable File
77 lines
1.5 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\User;
|
|
use App\Models\Categories;
|
|
use App\Models\Suppliers;
|
|
use App\Models\Coupon;
|
|
use App\Models\Status;
|
|
use App\Models\Technician;
|
|
use App\Models\ContractComment;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use TarfinLabs\LaravelSpatial\Casts\LocationCast;
|
|
use TarfinLabs\LaravelSpatial\Traits\HasSpatial;
|
|
|
|
class CurrentContracts extends Model
|
|
{
|
|
//
|
|
use HasSpatial;
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'supplier_id',
|
|
'category_id',
|
|
'address',
|
|
'int_number',
|
|
'references',
|
|
'appointment',
|
|
'amount',
|
|
'details',
|
|
'code',
|
|
'coupon_id',
|
|
'transaction_id',
|
|
'status_id',
|
|
'technical_id',
|
|
];
|
|
|
|
protected $casts = [
|
|
'location' => LocationCast::class
|
|
];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function categories()
|
|
{
|
|
return $this->belongsTo('App\Models\Categories', 'category_id');
|
|
}
|
|
|
|
public function suppliers()
|
|
{
|
|
return $this->belongsTo('App\Models\Suppliers', 'supplier_id');
|
|
}
|
|
|
|
public function coupon()
|
|
{
|
|
return $this->belongsTo(Coupon::class);
|
|
}
|
|
|
|
public function status()
|
|
{
|
|
return $this->belongsTo(Status::class);
|
|
}
|
|
|
|
public function technician()
|
|
{
|
|
return $this->belongsTo(Technician::class, 'technical_id');
|
|
}
|
|
|
|
public function contractComments()
|
|
{
|
|
return $this->hasMany(ContractComment::class, 'contract_id');
|
|
}
|
|
}
|