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        'issue_date',
30        'request_date',
31        'duration',
32        'order_number',
33        'acceptance_date',
34        'amount',
35        'reason_for_not_following_up',
36        'last_follow_up_date',
37        'last_follow_up_comment',
38        'reason_for_rejection_id',
39        'reason_for_rejection',
40        'commercial',
41        'created_at',
42        'created_by',
43        'updated_at',
44        'updated_by',
45        'for_add',
46        'for_approval',
47        'total_sent',
48        'people_assigned_to_the_job',
49        'duration_of_job_in_days',
50        'estimated_cost_of_materials',
51        'budget_margin_enabled',
52        'question_enabled',
53        'cost_of_labor',
54        'total_cost_of_job',
55        'invoice_margin',
56        'margin_for_the_company',
57        'margin_on_invoice_per_day_per_worker',
58        'revenue_per_date_per_worked',
59        'gross_margin',
60        'labor_percentage',
61        'question_ids',
62        'question_ids_no',
63        'approved_at',
64        'approved_by',
65        'rejected_at',
66        'rejected_by',
67        'approved_at_v2',
68        'approved_by_v2',
69        'rejected_at_v2',
70        'rejected_by_v2',
71        'accepted_at',
72        'accepted_by',
73        'x_message_id',
74        'x_status',
75        'from_company_id',
76        'sync_import',
77        'sync_import_edited',
78        'segment_by_g3w',
79        'source_by_g3w',
80        'status_by_g3w',
81        'type_by_g3w',
82        'from_company_id',
83        'box_work_g3w',
84        'user_create_by_g3w',
85        'user_commercial_by_g3w',
86        'g3w_warning',
87        'g3w_warning_fields',
88        'is_validated',
89        'resource_id',
90        'commission_cost',
91        'commission_pct',
92        'reason_id',
93        'reason_for_deletion',
94        'id_solicitud_duplicity',
95    ];
96
97    /**
98     * Check if there is a record with the `internal_quote_id` equal to `$g3w_id`.
99     *
100     * @param  $g3w_id  Int ID of the budget in G3W
101     * @return bool
102     */
103    public static function quotationExist($g3w_id)
104    {
105        return self::where('internal_quote_id', $g3w_id)->exists();
106    }
107}