Skip to content

Commit

Permalink
Merge pull request #130 from scholieren-com/nova-3.21-fix
Browse files Browse the repository at this point in the history
Implement RelatableField contract as required since Laravel Nova 3.21.0
  • Loading branch information
yassilah authored Feb 22, 2021
2 parents a7bbe88 + 24cf141 commit 1f3084a
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions src/NestedForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Yassi\NestedForm;

use function GuzzleHttp\json_encode;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
use Laravel\Nova\Contracts\RelatableField;
use Laravel\Nova\Fields\BelongsTo;
use Laravel\Nova\Fields\BelongsToMany;
use Laravel\Nova\Fields\Field;
Expand All @@ -24,33 +24,33 @@

use Laravel\Nova\Panel;

class NestedForm extends Field
class NestedForm extends Field implements RelatableField
{

/**
* Wrap left.
*
*
* @var string
*/
const WRAP_LEFT = '{{';

/**
* Wrap right.
*
*
* @var string
*/
const WRAP_RIGHT = '}}';

/**
* INDEX.
*
*
* @var string
*/
const INDEX = 'INDEX';

/**
* ID.
*
*
* @var string
*/
const ID = 'ID';
Expand Down Expand Up @@ -78,85 +78,85 @@ class NestedForm extends Field

/**
* The field's relationship resource class.
*
*
* @var string
*/
public $resourceClass;

/**
* The field's relationship resource name.
*
*
* @var string
*/
public $resourceName;

/**
* The field's relationship name.
*
*
* @var string
*/
public $viaRelationship;

/**
* The field's singular label.
*
*
* @var string
*/
public $singularLabel;

/**
* The field's plural label.
*
*
* @var string
*/
public $pluralLabel;

/**
* Default separator.
*
*
* @var string
*/
public $separator = '.';

/**
* From resource uriKey.
*
*
* @var string
*/
public $viaResource;

/**
* Key name.
*
*
* @var string
*/
public $keyName;


/**
* Whether the form should be opened by default.
*
*
* @var boolean
*/
public $opened = true;

/**
* The heading template for children.
*
*
* @var string
*/
public $heading;

/**
* The maximum number of children.
*
*
* @var int
*/
public $max = 0;

/**
* The minimum number of children.
*
*
* @var int
*/
public $min = 0;
Expand All @@ -168,7 +168,7 @@ class NestedForm extends Field

/**
* Return context
*
*
* @var Panel|Field|NestedForm
*/
protected $returnContext;
Expand Down Expand Up @@ -244,7 +244,7 @@ public function children($resource)

/**
* Set the heading.
*
*
* @param string $heading
*/
public function heading(string $heading)
Expand All @@ -256,7 +256,7 @@ public function heading(string $heading)

/**
* Set whether the form should be opened by default.
*
*
* @param boolean $opened
*/
public function open(bool $opened)
Expand All @@ -268,7 +268,7 @@ public function open(bool $opened)

/**
* Set the default separator.
*
*
* @param string $separator
*/
public function separator(string $separator)
Expand Down Expand Up @@ -555,7 +555,7 @@ public static function make(...$arguments)
/**
* Wrap an attribute into a dynamic attribute
* value.
*
*
* @param string $attribute
* @param string $default
*/
Expand All @@ -565,9 +565,9 @@ public static function wrapAttribute(string $attribute, $default = '')
}

/**
* Turn a given attribute string into
* Turn a given attribute string into
* a conditional attribute.
*
*
* @param string $attribute
*/
public static function conditional(string $attribute)
Expand Down

0 comments on commit 1f3084a

Please sign in to comment.