I am building a feature which generates a given number of download codes and popupates the DB table with them. So with this link downloadcodes/generate/10?type=1 I want to create 10 entries in my table.
The controller method looks like this:
public function generate($quantity)
{
$codetype = Input::get('type');
XXXX{ // ITERRATING LOOP from 1 to 10
$object = new DownloadCode;
$object->type = $codetype;
$object->code = [string-of random-6-digits];
$object->save();
}
return $quantity. " codes generated". $codetype;
}
Thank you.