parameters = get_route_parameters(); } public function delete() { $this->validate([ 'environment_id' => 'required|int', ]); $environment = Environment::findOrFail($this->environment_id); if ($environment->applications->count() > 0) { return $this->emit('error', 'Environment has resources defined, please delete them first.'); } $environment->delete(); return redirect()->route('project.show', ['project_uuid' => $this->parameters['project_uuid']]); } }