Skip to content

Commit

Permalink
Merge pull request #5 from dylanharbour/fix-user-relationship
Browse files Browse the repository at this point in the history
Fix the broken User relationship.
  • Loading branch information
dylanharbour authored Aug 5, 2019
2 parents f11837a + 3d40676 commit 9cf6791
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion config/workflow.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<?php

return [

'setup' => [
'user_class' => \App\User::class,
],

// this should be your model name in camelcase. eg. PropertyListing::Class => propertyListing
'user' => [
// class of your domain object
'class' => App\User::class,
'class' => \App\User::class,

// Register subscriber for this workflow which contains business rules. Uncomment line below to register subscriber
//'subscriber' => \App\Listeners\UserEventSubscriber::class,
Expand Down
2 changes: 1 addition & 1 deletion src/Models/StateWorkflowHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ public function model()
*/
public function user()
{
return $this->belongsTo(\App\User::class);
return $this->belongsTo(config('workflow.setup.user_class'));
}
}
6 changes: 5 additions & 1 deletion src/StateWorkflowServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ public function register()
$this->mergeConfigFrom($this->configPath(), 'workflow');

$this->app->singleton('stateWorkflow', function () {
return new WorkflowRegistry($this->app['config']->get('workflow'));
return new WorkflowRegistry(
collect($this->app['config']->get('workflow'))
->except('setup')
->toArray()
);
});

$this->app->alias('stateWorkflow', WorkflowRegistryInterface::class);
Expand Down

0 comments on commit 9cf6791

Please sign in to comment.