/** * Remove the specified resource from storage. * * @param int $id * @param EntryCrypt $entryCrypt * @return Response */ public function destroy($id, EntryCrypt $entryCrypt) { $model = UserTeam::findOrFail($id); if (!$model->delete()) { abort(403); } $this->getListOfEntries($model)->each(function ($entry) use($entryCrypt) { $entryCrypt->removeInvalidShares($entry); }); }
/** * 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')); }