“Faker Image Laravel 8” Código de respuesta

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

Respuestas similares a “Faker Image Laravel 8”

Preguntas similares a “Faker Image Laravel 8”

Más respuestas relacionadas con “Faker Image Laravel 8” en PHP

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código