Shift with red gradient lettering

Guess factory model

Laravel

Starting with Laravel 8, you no longer need to set the $model property on model factories when it may be guessed through Laravel conventions.

Before

class PostFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = \App\Models\Post::class;
 
// ...
}

After

class PostFactory extends Factory
{
// ...
}

← Back to the Workbench Tasks

Sign in with any of the following services to connect Shift with your Laravel project.


Don't use one of these services?

Temporarily push your project to a free, private repository on one of these cloud-based services or upgrade your project locally with Shift for Docker.