Answers for "laravel model factory with different returns"

PHP
1

laravel factory relations data

factory(AppUser::class, 30)->create()->each(function($user) {

    $entity = factory(AppEntity::class)->make();

    $address = factory(AppAddress::class)->create([
        'entity_id' => $entity
    ]);

    $user->entities()->save($entity);
});
Posted by: Guest on December-19-2020
1

make model factory and controller laravel

php artisan make:model ModelName -a
// -a stands for all (Model, Controller, Factory and Migration)
// Note: The above command will work successfully in Laravel 5.5 or > versions
Posted by: Guest on February-06-2021

Code answers related to "laravel model factory with different returns"

Browse Popular Code Answers by Language