Some checks failed
ci/woodpecker/push/ci Pipeline failed
- Add AgentStatus model for tracking user availability (online/away/busy/offline) - Add ChatQuickReply model for pre-written chat responses - Add agent status toggle to seller account dropdown menu - Add quick replies management page under CRM settings - Create migration for chat_quick_replies, chat_attachments, agent_statuses tables - Add API endpoint for updating agent status
51 lines
1.0 KiB
PHP
51 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class ChatQuickReply extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'chat_quick_replies';
|
|
|
|
protected $fillable = [
|
|
'business_id',
|
|
'label',
|
|
'message',
|
|
'category',
|
|
'usage_count',
|
|
'is_active',
|
|
'sort_order',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_active' => 'boolean',
|
|
'usage_count' => 'integer',
|
|
'sort_order' => 'integer',
|
|
];
|
|
|
|
public function business(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Business::class);
|
|
}
|
|
|
|
public function scopeActive($query)
|
|
{
|
|
return $query->where('is_active', true);
|
|
}
|
|
|
|
public function scopeByCategory($query, string $category)
|
|
{
|
|
return $query->where('category', $category);
|
|
}
|
|
|
|
public function incrementUsage(): void
|
|
{
|
|
$this->increment('usage_count');
|
|
}
|
|
}
|