HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-26-0-120 6.17.0-1009-aws #9~24.04.2-Ubuntu SMP Fri Mar 6 23:50:29 UTC 2026 x86_64
User: ubuntu (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/owlcrm/app/Models/Task.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Task extends Model
{
    use SoftDeletes;
    protected $table = 'tasks';
    use HasFactory;
    protected $fillable = [
        'subject',
        'start_date',
        'due_date',
        'priority',
        'assigned_to',
        'created_by',
        'entity_type',
        'entity_id',
        'description',
        'state',
        'status'
    ];
    protected $attributes = [
        'status' => 1,
    ];

    const PRIORITIES = [
        0 => '--Select--',
        'low' => 'Low',
        'medium' => 'Medium',
        'high' => 'High',
        'urgent' => 'Urgent',
    ];

    const Entity = [
        //'invoice' => 'Invoice',
        'lead' => 'Lead',
        'user' => 'User',

    ];
    const EntityId = [
        //'invoice' => 'Invoice',
        '0' => 'Lead',
        '1' => 'User',

    ];

    const States = [
        0 => '--Select--',
        'not-started' => 'Not Started',
        'in-progres' => 'In Progres',
        'awaiting-feedback' => 'AwaitingFeedback',
        'overdue' => 'Overdue',
        'completed' => 'Completed',
    ];

    const Lead = 'lead';
    const User = 'user';

    public function user()
    {
        return $this->belongsTo(User::class, 'assigned_to', 'id');
    }

    public function created_by_user()
    {
        return $this->belongsTo(User::class, 'created_by', 'id');
    }
    public function comments()
    {
        return $this->hasMany(Comment::class, 'task_id');
    }
}