What would be the best way to instantiate an external function within a controller in laravel?
I have the following code:
<?php
namespace App\RandomCode;
class RandomCode
{
function Generate()
{
$caracteres = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
$numerodeletras=8;
$cadena = "";
for($i=0;$i<$numerodeletras;$i++)
{
$cadena .= substr($caracteres,rand(0,strlen($caracteres)),1);
}
return $cadena;
}
}
in the App\Class
directory, which I need to call it within a controller.