0

I have string column in my table which supposed to store unique tokens but instead it stores something like this:

??6?i!a\????5?&?9?

Code

controller

use Illuminate\Support\Str;

public function store(Request $request)
{
  $recipient = new RsvpPerson;
  $recipient->token = Str::random(20);
  $recipient->save();
}

Schema

Schema::create('rsvp_people', function (Blueprint $table) {
    $table->uuid('id')->primary();
    $table->string('token')->unique();
    $table->timestamps();
}

any idea?

mafortis
  • 6,750
  • 23
  • 130
  • 288

1 Answers1

0

Solved

I'm not sure why laravel helper doesn't work but using this solved the problem

str_random(20)
mafortis
  • 6,750
  • 23
  • 130
  • 288