So imagine I have a database table, that has two columns:
operators. The fields can have below values:
and the operators column can have:
Now, I would like to show the above in my Blade view, but I wish to rewrite the actual values to something more readable.
I can do:
@forelse ($stream->rules as $rule) @if ($rule->field === 'fromName') From Name @endif @if ($rule->field === 'toName') To Name @endif @if ($rule->operator === '=') Equals @endif @if ($rule->field === '!=') Does Not Equals @endif @empty <div>No rules defined!</div> @endforelse
And so on - however this feel rather chunky and messy.
Is there a way to "map" the names more elegant?