public function destroy($dropletId, $userId) { $droplet = Droplet::where('user_id', '=', $userId)->findOrFail($dropletId); // Remove all of the files $droplet->delete(); return true; }
public function getByPath($path) { $parts = explode('/', $path); $filename = $parts[1]; $dropletSlug = $parts[0]; $file = Droplet::where('slug', '=', $dropletSlug)->files()->where('file_name', '=', $filename)->with('storage')->firstOrFail(); return $file; }