/** * Remove the specified resource from storage. * * @param int $id * @param EntryCrypt $entryCrypt * @return Response */ public function destroy($id, EntryCrypt $entryCrypt) { $model = ProjectTeam::findOrFail($id); $project = $model->project; if (!$model->delete()) { abort(403); } foreach ($project->keys as $key) { $entryCrypt->removeInvalidShares($key); } }
/** * Register any other events for your application. * * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void */ public function boot(DispatcherContract $events) { parent::boot($events); Event::subscribe('App\\Listeners\\Events\\AuthHistoryLogger'); Event::subscribe('App\\Listeners\\Events\\UserHistoryLogger'); Project::observe($this->app->make('App\\Events\\Observer\\ProjectObserver')); Entry::observe($this->app->make('App\\Events\\Observer\\EntryObserver')); Share::observe($this->app->make('App\\Events\\Observer\\ShareObserver')); Team::observe($this->app->make('App\\Events\\Observer\\TeamObserver')); EntryTag::observe($this->app->make('App\\Events\\Observer\\EntryTagObserver')); EntryTeam::observe($this->app->make('App\\Events\\Observer\\EntryTeamObserver')); ProjectTeam::observe($this->app->make('App\\Events\\Observer\\ProjectTeamObserver')); UserTeam::observe($this->app->make('App\\Events\\Observer\\UserTeamObserver')); }