Viewing file: HilltopAccount.php (1.06 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class HilltopAccount extends Model { protected $fillable = [ 'alias', 'hilltop_id', 'status', 'assigned_user_id', 'balance', 'last_synced_at', 'notes', ];
protected $casts = [ 'balance' => 'decimal:2', 'last_synced_at' => 'datetime', ];
/** * Get the user assigned to this account. */ public function assignedUser() { return $this->belongsTo(User::class, 'assigned_user_id'); }
/** * Scope a query to only include available accounts. */ public function scopeAvailable($query) { return $query->where('status', 'available'); }
/** * Scope a query to only include assigned accounts. */ public function scopeAssigned($query) { return $query->where('status', 'assigned'); }
/** * Get the audit logs for this account. */ public function auditLogs() { return $this->hasMany(AuditLog::class); }
}
|