phpemojilaravel-novacharset

How to Display Emojis in Laravel Nova


In Laravel Nova, I am trying to save User Feedback Emojis in the Database using its decimal value then display it in the dashboard.

But only the Decimal value is displayed not the Emoji Icon.

Eg. 🦂, 🤡, 💖

Is this possible in Nova? Or does it need to use a Third-party Library?

Here's my code:

public function fields(Request $request) {
  return [
    Text::make('Name', 'name')->sortable(),
    Text::make('Icon', 'icon')->sortable(),
  ];
}

EDIT: I am saving the actual characters in the database. I figured out that & is changed to &

enter image description here enter image description here

enter image description here


Solution

  • I already found the answer to my question.

    Using php html_entity_decode() fixed my problem.

    public function fields(Request $request) {
      return [
        Text::make('Name', 'name')->sortable(),
        Text::make('Icon', function() {
          return html_entity_decode($this->icon);
        })->sortable(),
      ];
    }
    

    enter image description here