Followup::updatedBy()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace App;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Carbon\Carbon;
7
use App\Enquiry;
8
9
class Followup extends Model
10
{
11
	protected $table = 'trn_enquiry_followups';
12
13
	protected $fillable = [
14
		'enquiry_id',
15
		'followup_by',
16
		'due_date',
17
		'status',
18
		'outcome',
19
		'created_by',
20
    	'updated_by',
21
	];
22
23
	protected $dates  = ['created_at', 'updated_at', 'due_date'];
24
25
	public function Enquiry()
26
	{
27
		return $this->belongsTo('App\Enquiry','enquiry_id');
28
	}
29
30
	public function scopeReminders($query)
31
	{
32
		return $query->leftJoin('mst_enquiries','trn_enquiry_followups.enquiry_id','=','mst_enquiries.id')
33
					 ->select('trn_enquiry_followups.*','mst_enquiries.status')
34
					 ->where('trn_enquiry_followups.due_date','<=',Carbon::today())
35
					 ->where('trn_enquiry_followups.status','=',\constFollowUpStatus::Pending)
36
					 ->where('mst_enquiries.status','=',\constEnquiryStatus::Lead);
37
	}
38
39
	public function createdBy()
40
    {
41
        return $this->belongsTo('App\User','created_by');
42
    }
43
44
    public function updatedBy()
45
    {
46
        return $this->belongsTo('App\User','updated_by');
47
    }
48
}