class Project extends Model
{
public function deployments()
{
return $this->hasManyThrough(
Deployment::class,
Environment::class,
'project_id', // Foreign key on the environments table...
'environment_id', // Foreign key on the deployments table...
'id', // Local key on the projects table...
'id' // Local key on the environments table...
);
}
}
class UserHandler {
static function handle($user, $data) {}
}
class UserObserver {
function saving(User $user) {}
}
// И в AppServiceProvider
User::observe(UserObserver::class);