Files
Jobhero_back/app/Models/Postulations.php
CarlosTorres 689e456fe5 fix: Corregir autenticación API, bypass de pago y relaciones de modelos
- Corregir middleware Authenticate para retornar JSON 401 en rutas API
- Agregar método unauthenticated() en Handler para respuestas JSON
- Implementar bypass de pago en ContractController
- Corregir relaciones belongsToMany en Postulations y Suppliers
- Corregir concatenación de strings en NoHomeController

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 23:48:27 +00:00

55 lines
1.1 KiB
PHP
Executable File

<?php
namespace App\Models;
use App\Models\User;
use App\Models\Categories;
use App\Models\Suppliers;
use App\Models\Status;
use Illuminate\Database\Eloquent\Model;
use TarfinLabs\LaravelSpatial\Casts\LocationCast;
use TarfinLabs\LaravelSpatial\Traits\HasSpatial;
class Postulations extends Model
{
//
use HasSpatial;
protected $fillable = [
'user_id',
'category_id',
'address',
'int_number',
'references',
'appointment',
'amount',
'details',
'status_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->belongsToMany(Suppliers::class, 'postulations_suppliers', 'postulations_id', 'suppliers_id')->withTimestamps();
}
public function status()
{
return $this->belongsTo(Status::class);
}
}