/** * @param Request $request * @param File $file * @throws \Exception */ public function destroy(Request $request, File $file) { $file->load('owner'); $owner = $this->owner($request); if ($file->owner->id == $owner->id) { $file->delete(); } }
protected function observers() { Image::observe('Modules\\Media\\ImageObserver'); Infographic::observe('Modules\\Media\\Infographics\\InfographicObserver'); File::observe('Modules\\Media\\Files\\FileObserver'); }