/** * Get all of the domains by the specified search * * @param $request * @return Collection */ public function search($request) { $domains = Domain::paginate(50); // Sets the parameters from the get request to the variables. if ($request->get('name')) { $name = $request->get('name'); $domains->where('name', 'like', "%{$name}%"); } return $domains; }
/** * Toggle Status Active * * @param int $id * @return \Illuminate\Http\Response */ public function toggle($id) { $domain = Domain::findOrFail($id); $data = ['status' => !$domain->status]; $domain = $this->domainRepository->updateDomain($data, $id); if ($domain) { return redirect()->route('dashboard.domains.index')->with('status', 'Estatus actualizado correctamente')->with('level', 'success'); } else { return redirect()->route('dashboard.domains.index')->with('status', 'Ocurrio una incidencia al actualizar el estatus, intentalo nuevamente')->with('level', 'warning'); } }