File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Tepuilabs \SimpleCrm \Models ;
4
4
5
+ use Illuminate \Database \Eloquent \Factories \HasFactory ;
5
6
use Illuminate \Database \Eloquent \Model ;
6
- use Tepuilabs \SimpleCrm \Models \Enums \LeadStatus ;
7
7
use Illuminate \Database \Eloquent \Relations \HasMany ;
8
- use Illuminate \Database \Eloquent \Factories \HasFactory ;
8
+ use Illuminate \Database \Eloquent \Relations \MorphMany ;
9
+ use Tepuilabs \SimpleCrm \Models \Enums \LeadStatus ;
9
10
10
11
/**
11
12
* @url https://www.hipb2b.com/blog/lead-prospect-whats-difference
@@ -29,16 +30,16 @@ class Lead extends Model
29
30
protected $ casts = [
30
31
'status ' => LeadStatus::class,
31
32
'type ' => LeadStatus::class,
32
- ];
33
+ ];
33
34
34
35
/**
35
36
* Notes relationship
36
37
*
37
- * @return HasMany
38
+ * @return MorphMany
38
39
*/
39
- public function notes (): HasMany
40
+ public function notes (): MorphMany
40
41
{
41
- return $ this ->hasMany (\Tepuilabs \SimpleCrm \Models \Note::class);
42
+ return $ this ->morphMany (\Tepuilabs \SimpleCrm \Models \Note::class, ' commentable ' );
42
43
}
43
44
44
45
/**
Original file line number Diff line number Diff line change @@ -32,6 +32,11 @@ public function author(): MorphTo
32
32
return $ this ->morphTo ();
33
33
}
34
34
35
+ public function commentable (): MorphTo
36
+ {
37
+ return $ this ->morphTo ();
38
+ }
39
+
35
40
public function lead (): BelongsTo
36
41
{
37
42
return $ this ->belongsTo (\Tepuilabs \SimpleCrm \Models \Lead::class);
You can’t perform that action at this time.
0 commit comments