Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
TblQuotations
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 quotationExist
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Models;
4
5use Illuminate\Database\Eloquent\Factories\HasFactory;
6use Illuminate\Database\Eloquent\Model;
7
8class TblQuotations extends Model
9{
10    use HasFactory;
11    protected $table = 'tbl_quotations';
12    public $timestamps = false;
13    protected $fillable = [
14        'quote_id',
15        'internal_quote_id',
16        'company_id',
17        'customer_type_id',
18        'budget_type_id',
19        'budget_status_id',
20        'source_id',
21        'client',
22        'client_type',
23        'segment_id',
24        'phone_number',
25        'email',
26        'issue_date',
27        'request_date',
28        'duration',
29        'order_number',
30        'acceptance_date',
31        'amount',
32        'reason_for_not_following_up',
33        'last_follow_up_date',
34        'last_follow_up_comment',
35        'reason_for_rejection_id',
36        'reason_for_rejection',
37        'commercial',
38        'created_at',
39        'created_by',
40        'updated_at',
41        'updated_by',
42        'for_add',
43        'for_approval',
44        'total_sent',
45        'people_assigned_to_the_job',
46        'duration_of_job_in_days',
47        'estimated_cost_of_materials',
48        'budget_margin_enabled',
49        'question_enabled',
50        'cost_of_labor',
51        'total_cost_of_job',
52        'invoice_margin',
53        'margin_for_the_company',
54        'margin_on_invoice_per_day_per_worker',
55        'revenue_per_date_per_worked',
56        'gross_margin',
57        'labor_percentage',
58        'question_ids',
59        'question_ids_no',
60        'approved_at',
61        'approved_by',
62        'rejected_at',
63        'rejected_by',
64        'approved_at_v2',
65        'approved_by_v2',
66        'rejected_at_v2',
67        'rejected_by_v2',
68        'accepted_at',
69        'accepted_by',
70        'x_message_id',
71        'x_status',
72        'from_company_id',
73        'sync_import',
74        'sync_import_edited',
75        'segment_by_g3w',
76        'source_by_g3w',
77        'status_by_g3w',
78        'type_by_g3w',
79        'from_company_id',
80        'box_work_g3w',
81        'user_create_by_g3w',
82        'user_commercial_by_g3w',
83        'g3w_warning',
84        'g3w_warning_fields',
85        'is_validated',
86        'resource_id',
87        'commission_cost',
88        'commission_pct',
89        'reason_id',
90        'reason_for_deletion'
91    ];
92
93    /**
94     * Check if there is a record with the `internal_quote_id` equal to `$g3w_id`.
95     * @param $g3w_id Int ID of the budget in G3W
96     * @return Boolean
97     */
98    public static function quotationExist($g3w_id)
99    {
100        return self::where('internal_quote_id', $g3w_id)->exists();
101    }
102}