Destroy given event media.

@param \Cortex\Bookings\Models\Event     $event
@param \Spatie\MediaLibrary\Models\Media $media

@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
964015
public function destroy(Event $event, Media $media)
    {
        $event->media()->where($media->getKeyName(), $media->getKey())->first()->delete();

        return intend([
            'url' => route('adminarea.events.media.index', ['event' => $event]),
            'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/foundation::common.media'), 'identifier' => $media->getRouteKey()])],
        ]);
    }
361
public function handleRemove(RemoveEvent $event)
    {
        $document = $event->getDocument();
        $this->documentRegistry->deregisterDocument($document);
    }
981818
public function deleteMaterial($media_id) {
		$data = $this->getData('/cgi-bin/material/del_material', [
			'access_token' => $this->getAccessToken(),
		], Json::encode(['media_id' => $media_id]));

		return $this->errcode == 0;
	}
890563
public function forget($event)
    {
        if (Str::contains($event, '*')) {
            unset($this->wildcards[$event]);
        } else {
            unset($this->listeners[$event]);
        }
    }
409694
private function removeOrphanMedias(Media $media)
    {
        if (count($media->getTweets()) == 0) {
            $this->_em->remove($media);
        }
    }
820438
public function deleteMediaAction(Request $request, $id)
    {
        $response = $this->getFilter($request);
        if ($response['success'] === false) {
            return $response['value'];
        }
        $filter = $response['value'];

        $mm = $this->getMediaManager();

        $media = $mm->findOneBy(array(
            'id' => $id,
            'filter' => $filter,
        ));

        if ($media !== null) {
            $media->setCryptedFilter($response['crypted']);
            $mm->delete($media);
        }

        return $this->createResponse($media);
    }
1256404
public function prepareMedia(Media $media)
    {
        $handler = $this->getHandler($media);
        $handler->prepareMedia($media);

        return $this;
    }
1361743
public static function onFlushContent(Event $event)
    {
        if (null === self::getEntityManager($event)) {
            return;
        }

        $contents_inserted = ScheduledEntities::getScheduledAClassContentInsertions(self::$em, true, true);
        $contents_updated = ScheduledEntities::getScheduledAClassContentUpdates(self::$em, true, true);
        $contents_deleted = ScheduledEntities::getSchedulesAClassContentDeletions(self::$em, true);

        // Updates content-content indexes
        self::updateIdxContentContents(array_merge($contents_inserted, $contents_updated), $contents_deleted);

        // Updates site-content indexes
        self::updateIdxSiteContents($contents_inserted, $contents_deleted);

        $content = $event->getTarget();
        if (!($content instanceof AbstractClassContent)) {
            return;
        }
        $dispatcher = $event->getDispatcher();
        $application = $dispatcher->getApplication();
        if (null === $application) {
            return;
        }

        $uow = self::$em->getUnitOfWork();

        if ($uow->isScheduledForInsert($content) || $uow->isScheduledForUpdate($content)) {
            self::$em->getRepository('BackBee\ClassContent\Indexes\OptContentByModified')
                    ->replaceOptContentTable($content);

            self::indexContent($content);
            self::updateSuperContentIndexes($content);
        } elseif ($uow->isScheduledForDelete($content)) {
            self::$em
                ->getRepository('BackBee\ClassContent\Indexes\OptContentByModified')
                ->removeOptContentTable($content)
            ;

            foreach ($content->getIndexation() as $index) {
                self::$em->remove($index);
                self::$em
                    ->getUnitOfWork()
                    ->computeChangeSet(self::$em->getClassMetadata('BackBee\ClassContent\Indexation'), $index)
                ;
            }
        }
    }
105116
public function destroy(Request $request, Evento $evento)
	{
		$this->authorize('admin',  Auth::user());
				
		$evento->delete();
	
		return redirect(route('evento'))->with('success', 'Evento Deleted!');
	}
662762
public function destroy(Page $page, Media $media)
    {
        $page->media()->where($media->getKeyName(), $media->getKey())->first()->delete();

        return intend([
            'url' => route('adminarea.pages.media.index', ['page' => $page]),
            'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/foundation::common.media'), 'identifier' => $media->getRouteKey()])],
        ]);
    }
917320
public function forget(Event $event)
    {
        $this->cache->store($this->store)->forget($event->mutexName());
    }
507665
public function deleteMedia($mediaId)
    {
        if ($mediaId instanceof Media) {
            $mediaId = $mediaId->id;
        }

        $media = $this->media->find($mediaId);

        if (! $media) {
            throw MediaCannotBeDeleted::doesNotBelongToModel($mediaId, $this);
        }

        $media->delete();
    }
773311
public static function off($event)
    {
        if (self::hasEvent($event)) {
            unset(self::$events[$event], self::$eventHandlers[$event]);

            return true;
        }

        return false;
    }
554205
protected function _deleteFile(Event $event) {
		try {
			$this->_beforeDeleteFile($event);
			$entity = $event->getData('entity');
			$path = $this->pathBuilder()->fullPath($entity);

			if ($this->getStorageAdapter($entity->adapter)->delete($path)) {
				$event->result = true;
				$event->setData('path', $path);
				$event->setData('entity', $entity);
				$this->_afterDeleteFile($event);

				return true;
			}
		} catch (\Exception $e) {
			$this->log($e->getMessage(), LogLevel::ERROR, ['scope' => ['storage']]);
			throw new StorageException($e->getMessage(), $e->getCode(), $e);
		}

		return false;
	}
935260
public function deleteAction(Request $request, $id)
    {
        $mediaManager = $this->get('opifer.media.media_manager');
        $media = $mediaManager->getRepository()->find($id);

        $dispatcher = $this->get('event_dispatcher');
        $event = new MediaResponseEvent($media, $request);
        $dispatcher->dispatch(OpiferMediaEvents::MEDIA_CONTROLLER_DELETE, $event);

        if (null !== $event->getResponse()) {
            return $event->getResponse();
        }

        $mediaManager->remove($media);

        return $this->redirectToRoute('opifer_media_media_index');
    }
989849
public function postDelete($mediaId)
    {
        $media = Media::findOrFail($mediaId);
        $media->delete();

        return redirect($this->admin->currentUrl())->with('notifications_below_header', [['type' => 'success', 'icon' => 'check-circle', 'title' => 'Success!', 'message' => 'The Media was successfully deleted.', 'dismissable' => false]]);
    }
722072
public function destroy(Banner $banner, Request $request)
    {
        // update list order
        $banner->update(['list_order' => 999]);

        $this->deleteEntry($banner, $request);

        return redirect_to_resource();
    }