Skip to content

Instantly share code, notes, and snippets.

@OMGZui
Created December 1, 2022 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OMGZui/24c4ba00fe93c2003554d5854fcd1653 to your computer and use it in GitHub Desktop.
Save OMGZui/24c4ba00fe93c2003554d5854fcd1653 to your computer and use it in GitHub Desktop.
// Factory.php
class Factory extends Model
{
public function workers()
{
return $this->hasMany(Worker::class);
}
}
// Worker.php
class Worker extends Model
{
public function factory()
{
return $this->belongsTo(Factory::class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment