“Faker Image Laravel 8” Respostas de código

Faker Image Laravel

use Faker\Generator as Faker; 
$factory->define(Product::class, function (Faker $faker) {
    return [

        'amount' => $faker->randomFloat(2, 0, 10000),
        'image' => $faker->image('public/storage/images',640,480, null, false),

    ];
});
Long Leopard

Faker Image Laravel 8

$factory->define(App\User::class, function (Faker\Generator $faker) {
    static $password;

    $filepath = storage_path('avatars');

    if(!File::exists($filepath)){
        File::makeDirectory($filepath);
    }

    return [
        'name' => $faker->name,
        'email' => $faker->unique()->safeEmail,
        'password' => $password ?: $password = bcrypt('secret'),
        'remember_token' => str_random(10),
        'avatar' => $faker->image($filepath,400, 300)
    ];
Careful Copperhead

Respostas semelhantes a “Faker Image Laravel 8”

Perguntas semelhantes a “Faker Image Laravel 8”

Mais respostas relacionadas para “Faker Image Laravel 8” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código