DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on • Updated on

Laravel Eloquent ORM Factory: Will afterMaking be called before afterCreating when I create a model with a factory;

Hello can you help me with that?

According to Laravel's documentation you can specify the triggers afterMaking and afterCreating. But I cannot figure out when these triggers are being called and in what sequence

So I have this scenario:

$myModel=factory(MyModel::class)->create();

With the following factory:

use Faker\Generator as Faker;
use App\Model\MyModel

$factory->define(MyModel::class,function(Faker $faker){

return [
   'sum'=>10
];

Top comments (0)