moh_abk
moh_abk

Reputation: 2164

Laravel Faker lowercase

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
    ];
});

Upvotes: 0

Views: 1757

Answers (1)

Ben Swinburne
Ben Swinburne

Reputation: 26467

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

    $city = $faker->city;

    return [
        'city' => $city,
        'value' => strtolower($city)
    ];
});

Upvotes: 3

Related Questions