Ejemplo n.º 1
0
 protected function handleRequest(Request $request)
 {
     $tid = \Route::input('id');
     // Fetch some info about the topic
     $topic = Topic::findOrFail($tid);
     // Make sure post authors and their groups are all loaded
     $topic->posts->load('author.group');
     $this->data['topic'] = $topic;
 }
Ejemplo n.º 2
0
 protected function run()
 {
     $tid = $this->get('id');
     $topic = Topic::findOrFail($tid);
     $user = User::current();
     if (!$topic->subscribers->contains($user)) {
         $topic->subscribers()->attach($user);
         $this->raise(new UserSubscribed($topic, $user));
     }
 }