File tree 1 file changed +26
-1
lines changed
1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,13 @@ class CallQueuedClosure implements ShouldQueue
36
36
*/
37
37
public $ deleteWhenMissingModels = true ;
38
38
39
+ /**
40
+ * Custom name for the job.
41
+ *
42
+ * @var string|null
43
+ */
44
+ public $ name = null ;
45
+
39
46
/**
40
47
* Create a new job instance.
41
48
*
@@ -103,8 +110,26 @@ public function failed($e)
103
110
*/
104
111
public function displayName ()
105
112
{
113
+ $ prefix = '' ;
106
114
$ reflection = new ReflectionFunction ($ this ->closure ->getClosure ());
107
115
108
- return 'Closure ( ' .basename ($ reflection ->getFileName ()).': ' .$ reflection ->getStartLine ().') ' ;
116
+ if (! is_null ($ this ->name )) {
117
+ $ prefix = "{$ this ->name } - " ;
118
+ }
119
+
120
+ return $ prefix .'Closure ( ' .basename ($ reflection ->getFileName ()).': ' .$ reflection ->getStartLine ().') ' ;
121
+ }
122
+
123
+ /**
124
+ * Set a custom name for the job.
125
+ *
126
+ * @param string $name
127
+ * @return $this
128
+ */
129
+ public function name ($ name )
130
+ {
131
+ $ this ->name = $ name ;
132
+
133
+ return $ this ;
109
134
}
110
135
}
You can’t perform that action at this time.
0 commit comments