File: /var/www/informe-admision/app/Models/Appointment.php
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Appointment extends Model
{
protected $connection = 'mysql_appointments';
protected $table = 'appointments';
protected $primaryKey = 'id';
protected $casts = [
'form_data' => 'array',
];
public function payment()
{
return $this->hasOne('App\Models\AppointmentPayment', 'appointment_id')->latest();
}
public function payments()
{
return $this->hasMany('App\Models\AppointmentPayment', 'appointment_id');
}
public function successPayment()
{
return $this->hasOne('App\Models\AppointmentPayment', 'appointment_id')
->where('status', 'SUCCESS')
->latest();
}
}