0

This sounds very trivial but I can't seem to figure it out...

I normally have my db columns like so;

Table Name: City
**id** - 1
**name** - Cityx
**value** - cityx

as you can see value is exactly like name but in lowercase. Now I'm trying to use $faker for php and wondering how I would do this

$factory->define(App\City::class, function ($faker) {
    return [
        'city' => $faker->city,
        'value' => , // make this lower case of $faker->city
    ];
});
moh_abk
  • 2,064
  • 7
  • 36
  • 65

1 Answers1

3
$factory->define(App\City::class, function ($faker) {

    $city = $faker->city;

    return [
        'city' => $city,
        'value' => strtolower($city)
    ];
});
Ben Swinburne
  • 25,669
  • 10
  • 69
  • 108