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
12    protected $table = 'tbl_quotations';
13
14    public $timestamps = false;
15
16    protected $fillable = [
17        'quote_id',
18        'internal_quote_id',
19        'company_id',
20        'customer_type_id',
21        'budget_type_id',
22        'budget_status_id',
23        'source_id',
24        'client',
25        'client_type',
26        'segment_id',
27        'phone_number',
28        'email',
29        'wa_message_id',
30        'wa_status',
31        'wa_y_message_id',
32        'wa_y_status',
33        'issue_date',
34        'request_date',
35        'duration',
36        'order_number',
37        'acceptance_date',
38        'amount',
39        'reason_for_not_following_up',
40        'last_follow_up_date',
41        'last_follow_up_comment',
42        'reason_for_rejection_id',
43        'reason_for_rejection',
44        'commercial',
45        'created_at',
46        'created_by',
47        'updated_at',
48        'updated_by',
49        'for_add',
50        'for_approval',
51        'approval_type',
52        'requires_technical_office',
53        'total_sent',
54        'people_assigned_to_the_job',
55        'duration_of_job_in_days',
56        'estimated_cost_of_materials',
57        'budget_margin_enabled',
58        'question_enabled',
59        'cost_of_labor',
60        'total_cost_of_job',
61        'invoice_margin',
62        'margin_for_the_company',
63        'margin_on_invoice_per_day_per_worker',
64        'revenue_per_date_per_worked',
65        'gross_margin',
66        'labor_percentage',
67        'question_ids',
68        'question_ids_no',
69        'approved_at',
70        'approved_by',
71        'rejected_at',
72        'rejected_by',
73        'approved_at_v2',
74        'approved_by_v2',
75        'rejected_at_v2',
76        'rejected_by_v2',
77        'accepted_at',
78        'accepted_by',
79        'x_message_id',
80        'x_status',
81        'from_company_id',
82        'sync_import',
83        'sync_import_edited',
84        'segment_by_g3w',
85        'source_by_g3w',
86        'status_by_g3w',
87        'type_by_g3w',
88        'from_company_id',
89        'box_work_g3w',
90        'user_create_by_g3w',
91        'user_commercial_by_g3w',
92        'g3w_warning',
93        'g3w_warning_fields',
94        'is_validated',
95        'resource_id',
96        'commission_cost',
97        'commission_pct',
98        'reason_id',
99        'reason_for_deletion',
100        'id_solicitud_duplicity',
101        'client_id',
102    ];
103
104    /**
105     * Check if there is a record with the `internal_quote_id` equal to `$g3w_id`.
106     *
107     * @param  $g3w_id  Int ID of the budget in G3W
108     * @return bool
109     */
110    public static function quotationExist($g3w_id)
111    {
112        return self::where('internal_quote_id', $g3w_id)->exists();
113    }
114}