“Faker Image Laravel 8” Kode Jawaban

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

Jawaban yang mirip dengan “Faker Image Laravel 8”

Pertanyaan yang mirip dengan “Faker Image Laravel 8”

Lebih banyak jawaban terkait untuk “Faker Image Laravel 8” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya