mardi 22 décembre 2015

Create random amount of strings

I need to create random amount (1, 4) of word 'sheep' to the form after I reload page. str_repeat is not what I need. Right now my program adds 1 sheep_id data.
P.S. also I need to add this data to 4 forms, id should repeat in these form (each data is unique)

<?php 
       $pageWasRefreshed = isset($_SERVER['HTTP_CACHE_CONTROL']) && $_SERVER['HTTP_CACHE_CONTROL'] === 'max-age=0';
        if($pageWasRefreshed ) {
          DB::table('sheep')->insert([
            'name' => 'sheep',
          ]);
        } 
?>

<select size="10">
@foreach ($sheeps as $sheep)
 <option>{{$sheep->name}}_{{$sheep->id }}</option>
@endforeach
</select>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire