Resource Tool not appearing
techenby opened this issue · comments
I've installed the package per the install instructions, updated my model and slightly altered the config file (see below). And the Resource Tool isn't appearing in nova. See screenshot of javascript errors below.
Thanks, Andy
Config:
<?php
return [
'workflows' => [
'request' => [ // workflow name
'model' => \App\Submission::class, //workflow applied to this model
'column' => 'status', // on this column
'states' => [ // the possible statuses
'pending',
'escalated',
'approved',
'rejected',
],
'transitions' => [
'Approve' => [
'from' => ['pending', 'escalated'],
'to' => 'approved',
'event' => \App\Events\SubmissionApproved::class, // fire event
'style_classes' => 'bg-success text-20'
],
'Escalate' => [
'from' => ['pending'],
'to' => 'escalated',
],
'Reject' => [
'from' => ['pending', 'escalated'],
'to' => 'rejected',
'style_classes' => 'bg-danger text-20'
],
'Back to My Employee' => [
'from' => ['escalated'],
'to' => 'pending',
'with_reasons' => 'escalation_note', // display a free textarea to write the comment on the this column name
],
],
],
],
];
Nova Resource:
public function fields(Request $request)
{
return [
ID::make()->sortable(),
Text::make('Type', function () {
return Str::singular($this->product->type->name);
})->sortable(),
BelongsTo::make('Build')->displayUsing(function () {
return $this->build->name . " #" . $this->build->number;
})->sortable(),
BelongsTo::make('User')->sortable(),
Text::make('Status')->sortable(),
Workflow::make('request')->onlyOnDetail(),
];
}
Nova screen:
Javascript Error:
FYI I'm using Nova 2.0 with Laravel 5.8, so I think the issue may be related to this bug: laravel/nova-issues#1399
I can confirm that adding a jsonSerialize method to Workflow.php fixes the issue. But I'm not sure if that's a lasting solution. Per this bug a PR was sent to upstream.
Thank you for your support. a new tag has been released to fix this issue