/** * Returns generated text from the Robot model. * * @return string */ public function generateTxt() { $robots = ""; foreach (Robot::all() as $robot) { $robots .= 'User-agent: ' . $robot->agent . PHP_EOL; foreach ($robot->directives as $directive) { $robots .= $directive->type . ': ' . $directive->data . PHP_EOL; } $robots .= PHP_EOL; } return $robots; }
/** * Returns generated text from the Robot model. * * @return string */ public function generateTxt() { $robots = ""; foreach (Robot::all() as $robot) { $robots .= 'User-agent: ' . $robot->agent . PHP_EOL; foreach ($robot->directives as $directive) { $robots .= $directive->type . ': ' . $directive->data . PHP_EOL; } $robots .= PHP_EOL; } /* * Compatability with RainLab.Sitemap */ if (class_exists('\\RainLab\\Sitemap\\Classes\\DefinitionItem')) { $url = URL::to('/sitemap.xml'); $robots .= 'Sitemap: ' . $url; } return $robots; }