Open abhimanusharma opened 4 years ago
I am trying to insert a record, for example, Total runs and highest scores. In this case, total runs can not be less than highest scores.
fzaninotto/faker
use Faker\Generator as Faker; $factory->define(App\Player::class, function (Faker $faker) { return [ 'total_runs' => $faker->randomNumber(4), 'highest_scores' => $faker->randomNumber(3), ]; });
Is there a direct method other than this?
$total_runs = $faker->randomNumber(4); $highest_scores = $faker->randomNumber(3); if($highest_scores > $total_runs){ $highest_scores = $total_runs - 1;} return[ 'total_runs' => $total_runs, 'highest_scores' => $highest_scores, ];
I've tried searching on google and looked in previous issues but could not found anything related to this. Please help.
Maybe it works for you.
$total_runs = $faker->randomNumber(4); $highest_scores = $faker->numberBetween(0, min($total_runs, 999));
$total_runs = $faker->randomNumber(4);
$highest_scores = $faker->numberBetween(0, min($total_runs, 999));
Summary
I am trying to insert a record, for example, Total runs and highest scores. In this case, total runs can not be less than highest scores.
Versions
fzaninotto/faker
Is there a direct method other than this?
I've tried searching on google and looked in previous issues but could not found anything related to this. Please help.