File: /var/www/html/owlcrm/app/Models/Reminder.php
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Reminder extends Model
{
use SoftDeletes;
protected $table = 'reminders';
use HasFactory;
const Lead = 'lead';
// const NO = 0;
protected $fillable = [
'reminder_to',
'created_by',
'entity_type',
'entity_id',
'description',
'reminder_date',
'is_notified',
'email_notification',
'status',
'user_id',
];
protected $attributes = [
'status' => 1,
];
const Entity = [
'lead' => 'Lead',
'user' => 'User',
];
const EntityId = [
//'invoice' => 'Invoice',
'0' => 'Lead',
'1' => 'User',
];
public function user() /* used for reminder and add reminder in leads*/
{
return $this->belongsTo(User::class, 'reminder_to', 'id');
}
public function created_by_user()
{
return $this->belongsTo(User::class, 'created_by', 'id');
}
public function reminder_user_get()
{
return $this->belongsTo(User::class, 'entity_id', 'id');
}
}