11
11
12
12
namespace CachetHQ \Cachet \Http \Controllers \Dashboard ;
13
13
14
+ use CachetHQ \Cachet \Bus \Commands \User \WelcomeUserCommand ;
14
15
use CachetHQ \Cachet \Integrations \Contracts \Feed ;
15
16
use CachetHQ \Cachet \Models \Component ;
16
17
use CachetHQ \Cachet \Models \ComponentGroup ;
17
18
use CachetHQ \Cachet \Models \Incident ;
18
19
use CachetHQ \Cachet \Models \Subscriber ;
19
20
use Illuminate \Routing \Controller ;
21
+ use Illuminate \Support \Facades \Auth ;
20
22
use Illuminate \Support \Facades \Config ;
21
23
use Illuminate \Support \Facades \Redirect ;
22
24
use Illuminate \Support \Facades \View ;
23
25
use Jenssegers \Date \Date ;
24
26
27
+ /**
28
+ * This is the dashboard controller class.
29
+ *
30
+ * @author James Brooks <james@alt-three.com>
31
+ */
25
32
class DashboardController extends Controller
26
33
{
27
34
/**
@@ -83,6 +90,11 @@ public function showDashboard()
83
90
$ componentGroups = ComponentGroup::whereIn ('id ' , $ usedComponentGroups )->orderBy ('order ' )->get ();
84
91
$ ungroupedComponents = Component::enabled ()->where ('group_id ' , 0 )->orderBy ('order ' )->orderBy ('created_at ' )->get ();
85
92
93
+ $ welcomeUser = !Auth::user ()->welcomed ;
94
+ if ($ welcomeUser ) {
95
+ dispatch (new WelcomeUserCommand (Auth::user ()));
96
+ }
97
+
86
98
$ entries = null ;
87
99
if ($ feed = $ this ->feed ->latest ()) {
88
100
$ entries = array_slice ($ feed ->channel ->item , 0 , 5 );
@@ -95,7 +107,8 @@ public function showDashboard()
95
107
->withSubscribers ($ subscribers )
96
108
->withEntries ($ entries )
97
109
->withComponentGroups ($ componentGroups )
98
- ->withUngroupedComponents ($ ungroupedComponents );
110
+ ->withUngroupedComponents ($ ungroupedComponents )
111
+ ->withWelcomeUser ($ welcomeUser );
99
112
}
100
113
101
114
/**
0 commit comments