5
5
use Illuminate \Database \Eloquent \Factories \HasFactory ;
6
6
use Illuminate \Database \Eloquent \Model ;
7
7
use Illuminate \Database \Eloquent \Relations \HasMany ;
8
+ use Tepuilabs \SimpleCrm \Models \Enums \Lead \LeadStatus ;
9
+ use Tepuilabs \SimpleCrm \Models \Enums \Lead \LeadType ;
8
10
9
11
/**
10
12
* @url https://www.hipb2b.com/blog/lead-prospect-whats-difference
@@ -13,17 +15,8 @@ class Lead extends Model
13
15
{
14
16
use HasFactory;
15
17
16
- const ORGANIC_TYPE = 'Organic ' ;
17
- const USER_SUBMITTED_TYPE = 'User Submitted ' ;
18
-
19
- const PROSPECT_STATUS = 'Prospect ' ;
20
- const LEAD_STATUS = 'Lead ' ;
21
- const CUSTOMER_STATUS = 'Customer ' ;
22
-
23
18
/**
24
- * The attributes that are mass assignable.
25
- *
26
- * @var array
19
+ * {@inheritdoc}
27
20
*/
28
21
protected $ fillable = [
29
22
'name ' ,
@@ -33,39 +26,20 @@ class Lead extends Model
33
26
];
34
27
35
28
/**
36
- * Notes relationship
37
- *
38
- * @return HasMany
29
+ * {@inheritdoc}
39
30
*/
40
- public function notes (): HasMany
41
- {
42
- return $ this ->hasMany (\App \Models \Tepuilabs \SimpleCrm \Note::class);
43
- }
44
-
45
- /**
46
- * Undocumented function
47
- *
48
- * @return array
49
- */
50
- public static function getTypes (): array
51
- {
52
- return [
53
- self ::ORGANIC_TYPE => self ::ORGANIC_TYPE ,
54
- self ::USER_SUBMITTED_TYPE => self ::USER_SUBMITTED_TYPE ,
55
- ];
56
- }
31
+ protected $ casts = [
32
+ 'status ' => LeadStatus::class,
33
+ 'type ' => LeadType::class,
34
+ ];
57
35
58
36
/**
59
- * Undocumented function
37
+ * Notes relationship
60
38
*
61
- * @return array
39
+ * @return HasMany
62
40
*/
63
- public static function getStatuses (): array
41
+ public function notes (): HasMany
64
42
{
65
- return [
66
- self ::PROSPECT_STATUS => self ::PROSPECT_STATUS ,
67
- self ::LEAD_STATUS => self ::LEAD_STATUS ,
68
- self ::CUSTOMER_STATUS => self ::CUSTOMER_STATUS ,
69
- ];
43
+ return $ this ->hasMany (Note::class);
70
44
}
71
45
}
0 commit comments