Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force cast for manipulate Flexible in Nova #414

Open
jordansitbon opened this issue Nov 9, 2022 · 1 comment · May be fixed by #409
Open

Force cast for manipulate Flexible in Nova #414

jordansitbon opened this issue Nov 9, 2022 · 1 comment · May be fixed by #409

Comments

@jordansitbon
Copy link

Hello,

It's possible to add $force params in flexible trait ?

	public function flexible($attribute, $layoutMapping = [], $force = false)
	{
		$flexible = data_get($this->attributes, $attribute);

		return $this->cast($flexible, $layoutMapping, $force);
	}

	public function cast($value, $layoutMapping = [], $force = false)
	{
		if (!$force && app()->getProvider(NovaServiceProvider::class) && ! app()->runningInConsole()) {
			return $value;
		}

		return $this->toFlexible($value ?: null, $layoutMapping);
	}
@Dartui
Copy link

Dartui commented Dec 2, 2022

Please look at #409, I've made PR which enables cast of Flexible field everywhere

@Dartui Dartui linked a pull request Dec 2, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants