/**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     Collaboration::saved(function ($collaboration) {
         $data = ['username' => Auth::user()->username, 'project_name' => session('project_name')];
         $subject = 'Call For Collaboration';
         $user = session('user_email');
         Mail::send('emails.collaborate', $data, function ($message) use($user, $subject) {
             $message->from('*****@*****.**', 'Prego');
             $message->to($user)->subject($subject);
         });
     });
 }
 /**
  * Get all the collaborators on this project
  * @param  int $id
  * @return collection
  */
 public function getCollaborators($id)
 {
     $collaborators = Collaboration::project($id)->get();
     return $collaborators;
 }
 /**
  * Check if the user about to be added as a collaborator is already on on the project
  * @param  int  $projectId
  * @param  int  $collaboratorId
  * @return boolean
  */
 private function isCollaborator($projectId, $collaboratorId)
 {
     return Collaboration::where('project_id', $projectId)->where('collaborator_id', $collaboratorId)->first();
 }